Skip to content

Commit

Permalink
[fix](Nereids) normalize aggregate should not push down lambda's param (
Browse files Browse the repository at this point in the history
#37109) (#37285)

pick from master #37109

ArrayItemSlot should not be inputSlot
  • Loading branch information
morrySnow authored Jul 5, 2024
1 parent 8373610 commit 256221a
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import org.apache.doris.nereids.analyzer.UnboundVariable;
import org.apache.doris.nereids.exceptions.AnalysisException;
import org.apache.doris.nereids.trees.AbstractTreeNode;
import org.apache.doris.nereids.trees.expressions.ArrayItemReference.ArrayItemSlot;
import org.apache.doris.nereids.trees.expressions.functions.ExpressionTrait;
import org.apache.doris.nereids.trees.expressions.functions.Nondeterministic;
import org.apache.doris.nereids.trees.expressions.functions.agg.AggregateFunction;
Expand Down Expand Up @@ -67,7 +68,8 @@ public abstract class Expression extends AbstractTreeNode<Expression> implements
private final boolean inferred;
private final boolean hasUnbound;
private final boolean compareWidthAndDepth;
private final Supplier<Set<Slot>> inputSlots = Suppliers.memoize(() -> collect(Slot.class::isInstance));
private final Supplier<Set<Slot>> inputSlots = Suppliers.memoize(
() -> collect(e -> e instanceof Slot && !(e instanceof ArrayItemSlot)));

protected Expression(Expression... children) {
super(children);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
-- This file is automatically generated. You should know what you did if you want to edit this
-- !test_upper_project_projections_rewrite2 --

-- !test_lambda --
1

Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,8 @@ suite("normalize_aggregate") {
qt_test_upper_project_projections_rewrite2 """
SELECT - + AVG ( DISTINCT - col0 ) * - col0 FROM
normalize_aggregate_tab WHERE + - col0 IS NULL GROUP BY col0 HAVING NULL IS NULL;"""

qt_test_lambda """
select count(array_filter(i -> (i > 0.99), array(1, 2, 3)))
"""
}

0 comments on commit 256221a

Please sign in to comment.