Skip to content

Wrong results of query with setting transform_null_in=1. #15310

@CurtizJ

Description

@CurtizJ

Describe the bug
Setting transform_null_in works incorrectly with IN operator over tuples.

How to reproduce
1.

CREATE TABLE null_in_1 (u UInt32, n Nullable(UInt32)) ENGINE = Memory;
INSERT INTO null_in_1 VALUES (1, NULL), (2, 2), (3, NULL), (4, 4), (5, NULL);
SET transform_null_in = 1;
SELECT count() FROM null_in_1 WHERE (u, n) IN ((42, NULL));

┌─count()─┐
│       3 │
└─────────┘

It interprets all rows, where n is NULL as matched, despite the value of u.

CREATE TABLE null_in_1 (a Nullable(UInt32), b Nullable(UInt32)) ENGINE = Memory;
INSERT INTO null_in_1 VALUES (1, NULL) (0, NULL) (NULL, NULL) (NULL, 1) (NULL, 0) (0, 0) (1, 1);
SET transform_null_in = 1;
SELECT count() FROM null_in_1 WHERE (a, b) IN (0, NULL);

┌─count()─┐
│       3 │
└─────────┘

SELECT count() FROM null_in_1 WHERE (a, b) IN (NULL, 0);

┌─count()─┐
│       3 │
└─────────┘

SELECT count() FROM null_in_1 WHERE (a, b) IN (0, 0);

┌─count()─┐
│       3 │
└─────────┘

It doesn't see the difference between default value and null value.

Metadata

Metadata

Assignees

Labels

bugConfirmed user-visible misbehaviour in official release

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions