yashlimbad commented on code in PR #4840:
URL: https://github.com/apache/calcite/pull/4840#discussion_r2958626555
##########
core/src/main/java/org/apache/calcite/plan/RelOptUtil.java:
##########
@@ -4818,22 +4831,55 @@ public RexInputConverter(
null,
leftDestFields,
rightDestFields,
- adjustments);
+ adjustments,
+ 0,
+ null);
}
public RexInputConverter(
RexBuilder rexBuilder,
@Nullable List<RelDataTypeField> srcFields,
@Nullable List<RelDataTypeField> destFields,
int[] adjustments) {
- this(rexBuilder, srcFields, destFields, null, null, adjustments);
+ this(rexBuilder, srcFields, destFields, null, null, adjustments, 0,
null);
}
public RexInputConverter(
RexBuilder rexBuilder,
@Nullable List<RelDataTypeField> srcFields,
int[] adjustments) {
- this(rexBuilder, srcFields, null, null, null, adjustments);
+ this(rexBuilder, srcFields, null, null, null, adjustments, 0, null);
+ }
+
+ public RexInputConverter(
+ RexBuilder rexBuilder,
+ @Nullable List<RelDataTypeField> srcFields,
+ @Nullable List<RelDataTypeField> destFields,
+ int[] adjustments,
+ int offset,
+ RelNode child) {
+ this(rexBuilder, srcFields, destFields, null, null, adjustments, offset,
child);
+ }
+
+ @Override public RexNode visitSubQuery(RexSubQuery subQuery) {
+ boolean[] update = {false};
+ List<RexNode> clonedOperands = visitList(subQuery.operands, update);
+ if (update[0]) {
+ subQuery = subQuery.clone(subQuery.getType(), clonedOperands);
+ final Set<CorrelationId> variablesSet =
RelOptUtil.getVariablesUsed(subQuery.rel);
+ if (!variablesSet.isEmpty() && correlateVariableChild != null) {
+ CorrelationId id = Iterables.getOnlyElement(variablesSet);
+ RelNode newSubQueryRel = subQuery.rel.accept(new
RelHomogeneousShuttle() {
+ @Override public RelNode visit(RelNode other) {
+ RelNode node =
+ RexUtil.shiftFieldAccess(rexBuilder, other, id,
correlateVariableChild, offset);
+ return super.visit(node);
+ }
+ });
+ subQuery = subQuery.clone(newSubQueryRel);
+ }
+ }
+ return subQuery;
Review Comment:
not needed
--
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]