From 33d007dc46753b520cd1f070c3747f43f288b8e3 Mon Sep 17 00:00:00 2001 From: Nikolai Kochetov Date: Wed, 13 Jan 2021 17:45:19 +0300 Subject: [PATCH 1/3] Fix function ignore with LowCardinality argument. --- src/Functions/ignore.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/Functions/ignore.cpp b/src/Functions/ignore.cpp index 7f78973907e..6b02c3a462d 100644 --- a/src/Functions/ignore.cpp +++ b/src/Functions/ignore.cpp @@ -30,6 +30,10 @@ public: bool useDefaultImplementationForNulls() const override { return false; } + /// We should never return LowCardinality result, cause we declare that result is always constant zero. + /// (in getResultIfAlwaysReturnsConstantAndHasArguments) + bool useDefaultImplementationForLowCardinalityColumns() const override { return false; } + String getName() const override { return name; From a0874d93c3778624e024701068d2c33d3606a1bc Mon Sep 17 00:00:00 2001 From: Nikolai Kochetov Date: Wed, 13 Jan 2021 17:47:08 +0300 Subject: [PATCH 2/3] Add test. --- .../0_stateless/01652_ignore_and_low_cardinality.reference | 0 tests/queries/0_stateless/01652_ignore_and_low_cardinality.sql | 3 +++ 2 files changed, 3 insertions(+) create mode 100644 tests/queries/0_stateless/01652_ignore_and_low_cardinality.reference create mode 100644 tests/queries/0_stateless/01652_ignore_and_low_cardinality.sql diff --git a/tests/queries/0_stateless/01652_ignore_and_low_cardinality.reference b/tests/queries/0_stateless/01652_ignore_and_low_cardinality.reference new file mode 100644 index 00000000000..e69de29bb2d diff --git a/tests/queries/0_stateless/01652_ignore_and_low_cardinality.sql b/tests/queries/0_stateless/01652_ignore_and_low_cardinality.sql new file mode 100644 index 00000000000..34049a98e4f --- /dev/null +++ b/tests/queries/0_stateless/01652_ignore_and_low_cardinality.sql @@ -0,0 +1,3 @@ +set allow_suspicious_low_cardinality_types = 1; +CREATE TABLE lc_null_int8_defnull (val LowCardinality(Nullable(Int8)) DEFAULT NULL) ENGINE = MergeTree order by tuple(); +SELECT ignore(10, ignore(*), ignore(ignore(-2, 1025, *)), NULL, *), * FROM lc_null_int8_defnull AS values; From 66fd7604101b51028a364645a5e1beb98aa57717 Mon Sep 17 00:00:00 2001 From: Nikolai Kochetov Date: Thu, 14 Jan 2021 13:45:57 +0300 Subject: [PATCH 3/3] Update test. --- .../0_stateless/01652_ignore_and_low_cardinality.reference | 1 + tests/queries/0_stateless/01652_ignore_and_low_cardinality.sql | 3 +++ 2 files changed, 4 insertions(+) diff --git a/tests/queries/0_stateless/01652_ignore_and_low_cardinality.reference b/tests/queries/0_stateless/01652_ignore_and_low_cardinality.reference index e69de29bb2d..573541ac970 100644 --- a/tests/queries/0_stateless/01652_ignore_and_low_cardinality.reference +++ b/tests/queries/0_stateless/01652_ignore_and_low_cardinality.reference @@ -0,0 +1 @@ +0 diff --git a/tests/queries/0_stateless/01652_ignore_and_low_cardinality.sql b/tests/queries/0_stateless/01652_ignore_and_low_cardinality.sql index 34049a98e4f..b3d3ad81834 100644 --- a/tests/queries/0_stateless/01652_ignore_and_low_cardinality.sql +++ b/tests/queries/0_stateless/01652_ignore_and_low_cardinality.sql @@ -1,3 +1,6 @@ set allow_suspicious_low_cardinality_types = 1; CREATE TABLE lc_null_int8_defnull (val LowCardinality(Nullable(Int8)) DEFAULT NULL) ENGINE = MergeTree order by tuple(); SELECT ignore(10, ignore(*), ignore(ignore(-2, 1025, *)), NULL, *), * FROM lc_null_int8_defnull AS values; + + +SELECT ignore(toLowCardinality(1), toLowCardinality(2), 3);