Skip to content

Query with a cast in where clause returned wrong result #3688

Open
@sduzh

Description

Describe the bug
If there are cast statements in where clause, a wrong result may be returned.

To Reproduce

create table t1(k bigint not null) DISTRIBUTED BY HASH(k) BUCKETS 1;
insert into t1 values(0), (1), (2), (3);
select * from t4 where cast(cast(k as boolean) as bigint) = 1;

Expected behavior

+------+
| k    |
+------+
|    1 |
|    2 |
|    3 |
+------+
6 rows in set (0.00 sec)

Real behavior

+------+
| k    |
+------+
|    1 |
+------+
2 rows in set (0.00 sec)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/sqlIssues or PRs related to SQLkind/fixCategorizes issue or PR as related to a bug.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions