Add additional tests for queries with toLowCardinality and toNullable

This commit is contained in:
Joshua Hildred 2024-04-10 19:09:03 -07:00
parent 70438f7e6e
commit 13774d897b
3 changed files with 7 additions and 2 deletions

View File

@ -627,7 +627,7 @@ private:
if (!child_function || !isBooleanFunction(child_function->getFunctionName()))
return;
if (function_node.getResultType()->isNullable() && !child_function->getResultType()->isNullable())
if (removeLowCardinality(constant->getResultType())->isNullable())
need_rerun_resolve = true;
if (maybe_invert)

View File

@ -17,6 +17,10 @@
100
100
101
100
101
100
101
1
1
1

View File

@ -26,7 +26,8 @@ SELECT * FROM test_table WHERE (NOT ((k in (101) = 0) OR (k in (100) = 1))) = 1;
SELECT * FROM test_table WHERE ((k not in (101) = 0) OR (k in (100) = 1)) = 1;
SELECT * FROM test_table WHERE ((k not in (99) = 1) AND (k in (100) = 1)) = 1;
SELECT * FROM test_table WHERE ((k not in (101) = toNullable(0)) OR (k in (100) = toNullable(1))) = toNullable(1);
SELECT * FROM test_table WHERE (((k NOT IN toLowCardinality(toNullable(101))) = toLowCardinality(toNullable(0))) OR ((k IN (toLowCardinality(100))) = toNullable(1)));
SELECT * FROM test_table WHERE (((k IN toLowCardinality(toNullable(101))) = toLowCardinality(toNullable(0))) AND ((k NOT IN (toLowCardinality(100))) = toNullable(1))) = toNullable(toLowCardinality(0));
SELECT count()
FROM