Skip to content

[Bug] The result may be wrong if the left side of the in bitmap predicate is a constant #17561

@luozenglin

Description

@luozenglin

Search before asking

  • I had searched in the issues and found no similar issues.

Version

1.2

What's Wrong?

mysql>  select k1, k2 from test_query_db.bigtable t where 11 in (select k2 from regression_test_query_p0_join.bitmap_table) order by 1, 2;
+------+--------+
| k1   | k2     |
+------+--------+
| NULL |   NULL |
| NULL |   NULL |
|    1 |   1989 |
|    1 |   1989 |
|    2 |   1986 |
|    2 |   1986 |
|    3 |   1989 |
|    3 |   1989 |
|    4 |   1991 |
|    4 |   1991 |
|    5 |   1985 |
|    5 |   1985 |
|    6 |  32767 |
|    6 |  32767 |
|    7 | -32767 |
|    7 | -32767 |
|    8 |    255 |
|    8 |    255 |
|    9 |   1991 |
|    9 |   1991 |
|   10 |   1991 |
|   10 |   1991 |
|   11 |   1989 |
|   11 |   1989 |
|   12 |  32767 |
|   12 |  32767 |
|   13 | -32767 |
|   13 | -32767 |
|   14 |    255 |
|   14 |    255 |
|   15 |   1992 |
|   15 |   1992 |
+------+--------+
32 rows in set (1.92 sec)

What You Expected?

mysql> select k1, k2 from test_query_db.bigtable t where 11 in (select k2 from regression_test_query_p0_join.bitmap_table) order by 1, 2;
+------+--------+
| k1   | k2     |
+------+--------+
| NULL |   NULL |
|    1 |   1989 |
|    2 |   1986 |
|    3 |   1989 |
|    4 |   1991 |
|    5 |   1985 |
|    6 |  32767 |
|    7 | -32767 |
|    8 |    255 |
|    9 |   1991 |
|   10 |   1991 |
|   11 |   1989 |
|   12 |  32767 |
|   13 | -32767 |
|   14 |    255 |
|   15 |   1992 |
+------+--------+
16 rows in set (0.32 sec)

How to Reproduce?

No response

Anything Else?

No response

Are you willing to submit PR?

  • Yes I am willing to submit a PR!

Code of Conduct

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions