mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-22 23:52:03 +00:00
Merge pull request #61249 from mkmkme/mkmkme/fix-has-function
Fix `has()` function with `Nullable` column
This commit is contained in:
commit
24d6dcb96b
@ -1007,8 +1007,13 @@ private:
|
||||
if (!(*null_map)[row])
|
||||
continue;
|
||||
}
|
||||
else if (!applyVisitor(FieldVisitorAccurateEquals(), arr[i], value))
|
||||
continue;
|
||||
else
|
||||
{
|
||||
if (null_map && (*null_map)[row])
|
||||
continue;
|
||||
if (!applyVisitor(FieldVisitorAccurateEquals(), arr[i], value))
|
||||
continue;
|
||||
}
|
||||
|
||||
ConcreteAction::apply(data[row], i);
|
||||
|
||||
|
14
tests/queries/0_stateless/00662_has_nullable.reference
Normal file
14
tests/queries/0_stateless/00662_has_nullable.reference
Normal file
@ -0,0 +1,14 @@
|
||||
Nullable(UInt64), non-null array
|
||||
1 1
|
||||
\N 0
|
||||
Non-nullable UInt64, nullable array
|
||||
0 0
|
||||
1 1
|
||||
2 1
|
||||
Nullable(UInt64), nullable array
|
||||
0 0
|
||||
\N 1
|
||||
1 1
|
||||
All NULLs
|
||||
0 0
|
||||
\N 1
|
39
tests/queries/0_stateless/00662_has_nullable.sql
Normal file
39
tests/queries/0_stateless/00662_has_nullable.sql
Normal file
@ -0,0 +1,39 @@
|
||||
DROP TABLE IF EXISTS 00662_has_nullable;
|
||||
|
||||
SELECT 'Nullable(UInt64), non-null array';
|
||||
CREATE TABLE 00662_has_nullable(a Nullable(UInt64)) ENGINE = Memory;
|
||||
|
||||
INSERT INTO 00662_has_nullable VALUES (1), (Null);
|
||||
SELECT a, has([0, 1], a) FROM 00662_has_nullable;
|
||||
|
||||
DROP TABLE 00662_has_nullable;
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
SELECT 'Non-nullable UInt64, nullable array';
|
||||
CREATE TABLE 00662_has_nullable(a UInt64) ENGINE = Memory;
|
||||
|
||||
INSERT INTO 00662_has_nullable VALUES (0), (1), (2);
|
||||
SELECT a, has([NULL, 1, 2], a) FROM 00662_has_nullable;
|
||||
|
||||
DROP TABLE 00662_has_nullable;
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
SELECT 'Nullable(UInt64), nullable array';
|
||||
CREATE TABLE 00662_has_nullable(a Nullable(UInt64)) ENGINE = Memory;
|
||||
|
||||
INSERT INTO 00662_has_nullable VALUES (0), (Null), (1);
|
||||
SELECT a, has([NULL, 1, 2], a) FROM 00662_has_nullable;
|
||||
|
||||
DROP TABLE 00662_has_nullable;
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
SELECT 'All NULLs';
|
||||
CREATE TABLE 00662_has_nullable(a Nullable(UInt64)) ENGINE = Memory;
|
||||
|
||||
INSERT INTO 00662_has_nullable VALUES (0), (Null);
|
||||
SELECT a, has([NULL, NULL], a) FROM 00662_has_nullable;
|
||||
|
||||
DROP TABLE 00662_has_nullable;
|
Loading…
Reference in New Issue
Block a user