Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

When an integer variable is used as an operand, there is a logical error with the IN operator. #29047

Open
LingweiKuang opened this issue Dec 5, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@LingweiKuang
Copy link

LingweiKuang commented Dec 5, 2024

Bug Description

The abstract expression sequence is: column IN (constant)

To Reproduce

Assume that we execute the following statement under a database named testdb.

DROP TABLE IF EXISTS t1;
CREATE TABLE t1(time TIMESTAMP, c1 INT);
INSERT INTO t1(time, c1) VALUES (1641024000000, 1);

# query 1
SELECT c1 FROM t1 WHERE c1 IN (1.7);

# query 2
SELECT c1 FROM t1 WHERE c1 == 1.7;

Expected Behavior

Query 1 returned result set: empty set

Query 2 returned result set: empty set

Actual behaviour

Query 1 returned result set: 1

Query 2 returned result set: empty set

Environment

  • OS:Ubuntu Server 22.04 LTS 64bit
  • TDengine Version:3.3.4.8

Additional Context

Hello, TDengine team. In Query 1, when the IN operator is used for conditional filtering on an integer column, if the constant expression for the IN operator is a floating-point number, it can still filter out values even if their numeric values are not equal. Theoretically, Query 2 is equivalent to Query 1.

@LingweiKuang LingweiKuang added the bug Something isn't working label Dec 5, 2024
@LingweiKuang
Copy link
Author

LingweiKuang commented Dec 5, 2024

When an integer variable is used as an operand, there is a logical error with the IN operator

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant