danny0405 commented on a change in pull request #1462:
[CALCITE-3353]ProjectJoinTransposeRule caused AssertionError when creating a
new Join
URL: https://github.com/apache/calcite/pull/1462#discussion_r333806123
##########
File path: core/src/main/java/org/apache/calcite/plan/RelOptUtil.java
##########
@@ -436,6 +436,29 @@ public static void verifyTypeEquivalence(
return mapping;
}
+ /**
+ * Returns a permutation describing where the Project's fields come from
+ * after the Project is pushed down.
+ */
+ public static Mappings.TargetMapping permutationPushDownProject(
+ List<RexNode> nodes,
+ RelDataType inputRowType,
+ int sourceOffset,
+ int targetOffset) {
+ final Mappings.TargetMapping mapping =
+ Mappings.create(MappingType.PARTIAL_FUNCTION,
+ inputRowType.getFieldCount() + sourceOffset,
+ nodes.size() + targetOffset);
+ for (Ord<RexNode> node : Ord.zip(nodes)) {
+ if (node.e instanceof RexInputRef) {
Review comment:
Should we still consider the collation shifting when the project node is not
a `inputRef`, i.e. how about there is a
monotonically increasing function call ?
----------------------------------------------------------------
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