Skip to content

Commit

Permalink
modified based on comments
Browse files Browse the repository at this point in the history
  • Loading branch information
starocean999 committed Jul 12, 2024
1 parent 04108b9 commit 5502b65
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -103,15 +103,15 @@ public List<Rule> buildRules() {
Utils.getUnCorrelatedExprs(correlatedPredicate, apply.getCorrelationSlot());
newGroupby.addAll(agg.getGroupByExpressions());
Map<Expression, Slot> unCorrelatedExprToSlot = Maps.newHashMap();
newAggOutput.addAll(newGroupby.stream().map(expression -> {
for (Expression expression : newGroupby) {
if (expression instanceof Slot) {
return (NamedExpression) expression;
newAggOutput.add((NamedExpression) expression);
} else {
Alias alias = new Alias(expression);
unCorrelatedExprToSlot.put(expression, alias.toSlot());
return alias;
newAggOutput.add(alias);
}
}).collect(ImmutableList.toImmutableList()));
}
correlatedPredicate = ExpressionUtils.replace(correlatedPredicate, unCorrelatedExprToSlot);
LogicalAggregate newAgg = new LogicalAggregate<>(newGroupby, newAggOutput,
PlanUtils.filterOrSelf(ImmutableSet.copyOf(unCorrelatedPredicate), filter.child()));
Expand Down

0 comments on commit 5502b65

Please sign in to comment.