Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
englefly committed Jan 9, 2025
1 parent 231c07a commit 8fc5aab
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -957,7 +957,13 @@ public PlanFragment visitPhysicalHashAggregate(
// 1. generate slot reference for each group expression
List<SlotReference> groupSlots = collectGroupBySlots(groupByExpressions, outputExpressions);
ArrayList<Expr> execGroupingExpressions = groupByExpressions.stream()
.map(e -> ExpressionTranslator.translate(e, context))
.map(e -> {
Expr result = ExpressionTranslator.translate(e, context);
if (result == null) {
throw new RuntimeException("translate " + e + " failed");
}
return result;
})
.collect(Collectors.toCollection(ArrayList::new));
// 2. collect agg expressions and generate agg function to slot reference map
List<Slot> aggFunctionOutput = Lists.newArrayList();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ public Plan visitPhysicalHashAggregate(PhysicalHashAggregate<? extends Plan> agg
PhysicalProject<? extends Plan> project = (PhysicalProject<? extends Plan>) aggregate.child();
List<NamedExpression> newProjections = Lists.newArrayList();
for (NamedExpression expr : project.getProjects()) {
if (aggOutputReplaced.contains(expr)) {
if (!(expr instanceof SlotReference) || aggOutputReplaced.contains(expr)) {
newProjections.add(expr);
}
}
Expand Down

0 comments on commit 8fc5aab

Please sign in to comment.