my7ym commented on a change in pull request #1104: [CALCITE-2900]
RewriteRexShuttle generates wrong type during flatten for structured type when
visitInputRef
URL: https://github.com/apache/calcite/pull/1104#discussion_r266295282
##########
File path:
core/src/main/java/org/apache/calcite/sql2rel/RelStructuredTypeFlattener.java
##########
@@ -328,13 +330,24 @@ protected int getNewForOldInput(int oldOrdinal) {
assert newInput != null;
RelDataType oldInputType = oldInput.getRowType();
- final int newOffset = calculateFlattenedOffset(oldInputType, oldOrdinal);
+ final int newOffset = calculateFlattenedOffset(oldInputType, oldOrdinal) +
existingOffset;
newOrdinal += newOffset;
final RelDataTypeField field =
newInput.getRowType().getFieldList().get(newOffset);
return Ord.of(newOrdinal, field.getType());
}
+ /**
+ * Maps the ordinal of a field pre-flattening to the ordinal of the
+ * corresponding field post-flattening, and also returns its type.
+ *
+ * @param oldOrdinal Pre-flattening ordinal
+ * @return Post-flattening ordinal and type
+ */
+ protected Ord<RelDataType> getNewFieldForOldInput(int oldOrdinal) {
Review comment:
@zabetak This is the old function signature so I have to keep them to keep
backward compatibility.
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services