ISSUES-4389 fix lambda function with predicate optimizer

This commit is contained in:
zhang2014 2019-02-15 16:03:18 +08:00
parent ed3a8a66a2
commit 597ae0b937
3 changed files with 14 additions and 2 deletions

View File

@ -119,8 +119,10 @@ bool PredicateExpressionsOptimizer::allowPushDown(const ASTSelectQuery * subquer
for (const auto & subquery_function : extract_data.functions) for (const auto & subquery_function : extract_data.functions)
{ {
const auto & function = FunctionFactory::instance().get(subquery_function->name, context); const auto & function = FunctionFactory::instance().tryGet(subquery_function->name, context);
if (function->isStateful())
/// Skip lambda、tuple and other special functions
if (function && function->isStateful())
return false; return false;
} }

View File

@ -7,3 +7,6 @@
1 a 0 1 a 0
2 b 0 2 b 0
2 a 0 2 a 0
(1,1)
(3,2)
(5,2)

View File

@ -29,4 +29,11 @@ SELECT n, z, changed FROM (
) )
) WHERE changed = 0; ) WHERE changed = 0;
SELECT arrayJoin(arrayMap(x -> x, arraySort(groupArray((ts, n))))) AS k FROM (
SELECT ts, n, z FROM system.one ARRAY JOIN [1, 3, 4, 5, 6] AS ts, [1, 2, 2, 2, 1] AS n, ['a', 'a', 'b', 'a', 'b'] AS z
ORDER BY n ASC, ts DESC
) WHERE z = 'a' GROUP BY z;
DROP TABLE IF EXISTS test.test; DROP TABLE IF EXISTS test.test;