Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
englefly committed Sep 11, 2024
1 parent 2e4942b commit d1b8292
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import org.apache.doris.nereids.trees.expressions.Alias;
import org.apache.doris.nereids.trees.expressions.Expression;
import org.apache.doris.nereids.trees.expressions.NamedExpression;
import org.apache.doris.nereids.trees.expressions.OrderExpression;
import org.apache.doris.nereids.trees.expressions.Slot;
import org.apache.doris.nereids.trees.expressions.SlotReference;
import org.apache.doris.nereids.trees.expressions.functions.agg.AggregateFunction;
Expand Down Expand Up @@ -130,7 +131,7 @@ public Plan visitPhysicalHashAggregate(PhysicalHashAggregate<? extends Plan> agg
private void getCseCandidatesFromAggregateFunction(Expression expr, Map<Expression, Alias> result) {
if (expr instanceof AggregateFunction) {
for (Expression child : expr.children()) {
if (!(child instanceof SlotReference) && !child.isConstant()) {
if (!(child instanceof SlotReference) && !child.isConstant() && !(child instanceof OrderExpression)) {
if (child instanceof Alias) {
result.put(child, (Alias) child);
} else {
Expand Down
6 changes: 3 additions & 3 deletions regression-test/data/nereids_tpch_p0/tpch/agg_cse.out
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
-- This file is automatically generated. You should know what you did if you want to edit this
-- !select --
2 2.0 3
8 8.0 9
-- !1 --
0 0.0 1
2 2.0 3
4 4.0 5
6 6.0 7
8 8.0 9

-- !agg_cse_subquery --
0 0.0 1
Expand Down
4 changes: 2 additions & 2 deletions regression-test/suites/nereids_tpch_p0/tpch/agg_cse.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ suite("agg_cse") {
sql 'set enable_nereids_planner=true'
sql 'set enable_fallback_to_original_planner=false'

qt_select """
qt_1 """
select sum(r_regionkey + r_regionkey), avg(r_regionkey + r_regionkey), sum(r_regionkey + (r_regionkey+1))
from region group by r_name;
from region group by r_name order by 1, 2, 3;
"""
explain{
sql """
Expand Down

0 comments on commit d1b8292

Please sign in to comment.