You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@calcite.apache.org by GitBox <gi...@apache.org> on 2020/11/03 13:39:17 UTC

[GitHub] [calcite] yanlin-Lynn commented on a change in pull request #2163: [CALCITE-4273] Support get expression lineage for Calc

yanlin-Lynn commented on a change in pull request #2163:
URL: https://github.com/apache/calcite/pull/2163#discussion_r516402810



##########
File path: core/src/main/java/org/apache/calcite/rel/metadata/RelMdExpressionLineage.java
##########
@@ -407,6 +409,35 @@ protected RelMdExpressionLineage() {}
     return mq.getExpressionLineage(rel.getInput(), outputExpression);
   }
 
+  /**
+   * Expression lineage from Calc.
+   */
+  public Set<RexNode> getExpressionLineage(Calc calc,
+      RelMetadataQuery mq, RexNode outputExpression) {
+    final RelNode input = calc.getInput();
+    final RexBuilder rexBuilder = calc.getCluster().getRexBuilder();
+    // Extract input fields referenced by expression
+    final ImmutableBitSet inputFieldsUsed = extractInputRefs(outputExpression);
+
+    // Infer column origin expressions for given references
+    final Map<RexInputRef, Set<RexNode>> mapping = new LinkedHashMap<>();
+    Pair<ImmutableList<RexNode>, ImmutableList<RexNode>> calcFilterAndProjects =
+        calc.getProgram().split();

Review comment:
       OK, I'll update 




----------------------------------------------------------------
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:
users@infra.apache.org