iwanttobepowerful commented on code in PR #5404:
URL: https://github.com/apache/calcite/pull/5404#discussion_r4553054858
##########
core/src/main/java/org/apache/calcite/sql2rel/RelDecorrelator.java:
##########
@@ -680,10 +680,20 @@ protected RexNode removeCorrelationExpr(
int newPos = 0;
final List<Integer> groupKeyIndices = rel.getGroupSet().asList();
+ // Decorrelation adds no correlation key to the group key.
Review Comment:
final List<Integer> groupKeyIndices = rel.getGroupSet().asList();
// If decorrelation adds no correlation key, keep the constant keys:
// GROUP BY TRUE gives no row for an empty input, but GROUP BY ()
// gives one row.
final boolean keepConstantKeys = frame.corDefOutputs.isEmpty();
final NavigableMap<Integer, RexLiteral> omittedConstants = new TreeMap<>();
for (int i = 0; i < oldGroupKeyCount; i++) {
final int idx = groupKeyIndices.get(i);
final RexLiteral constant =
keepConstantKeys ? null : projectedLiteral(newInput, idx);
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]