Skip to content

In STABLE, there is a logical error when combining the IS NULL and IN operators. #29067

Closed
@LingweiKuang

Description

@LingweiKuang

Bug Description

The abstract expression sequence is: column IS [NOT] NULL AND column IN (constant)

To Reproduce

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

DROP STABLE super_t1;
DROP TABLE t1;
CREATE STABLE IF NOT EXISTS super_t1(time TIMESTAMP, c0 BIGINT UNSIGNED) TAGS (location BINARY(64));
CREATE TABLE t1 USING super_t1 TAGS ('ek');
INSERT INTO t1(time, c0) VALUES (1641024000000, 1);
INSERT INTO t1(time, c0) VALUES (1641024005000, 2);
INSERT INTO t1(time, c0) VALUES (1641024010000, NULL);

# query 1
SELECT * FROM t1 WHERE c0 IS NOT NULL AND c0 IN (-1);

# query 2
SELECT * FROM t1 WHERE c0 IS NULL AND c0 IN (-1);

Expected Behavior

Expected result set for Query 1: empty set

Expected result set for Query 2: empty set

Actual behaviour

Query 1 returned result set: 1 and 2

Query 2 returned result set: NULL

Environment

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

Additional Context

Hello, TDengine team. The predicate evaluations for both Query 1 and Query 2 result in FALSE, and theoretically, no data should be retrieved from the database. However, in STABLE, we are able to retrieve all data that satisfies the IS [NOT] NULL condition, , while the IN operator has no effect.

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions