Class RelMdExpressionLineage
- All Implemented Interfaces:
- MetadataHandler<BuiltInMetadata.ExpressionLineage>
RelMetadataQuery.getExpressionLineage(org.apache.calcite.rel.RelNode, org.apache.calcite.rex.RexNode) for the standard logical
 algebra.
 The goal of this provider is to infer the lineage for the given expression.
The output expressions might contain references to columns produced by
 TableScan operators (RexTableInputRef). In turn, each
 TableScan operator is identified uniquely by a RexTableInputRef.RelTableRef containing
 its qualified name and an identifier.
 
If the lineage cannot be inferred, we return null.
- 
Field SummaryFields
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptioncreateAllPossibleExpressions(RexBuilder rexBuilder, RexNode expr, Map<RexInputRef, Set<RexNode>> mapping) Given an expression, it will create all equivalent expressions resulting from replacing all possible combinations of references in the mapping by the corresponding expressions.getDef()getExpressionLineage(RelSubset rel, RelMetadataQuery mq, RexNode outputExpression) getExpressionLineage(Aggregate rel, RelMetadataQuery mq, RexNode outputExpression) Expression lineage fromAggregate.getExpressionLineage(Calc calc, RelMetadataQuery mq, RexNode outputExpression) Expression lineage from Calc.getExpressionLineage(Exchange rel, RelMetadataQuery mq, RexNode outputExpression) Expression lineage from Exchange.getExpressionLineage(Filter rel, RelMetadataQuery mq, RexNode outputExpression) Expression lineage from Filter.getExpressionLineage(Join rel, RelMetadataQuery mq, RexNode outputExpression) Expression lineage fromJoin.getExpressionLineage(Project rel, RelMetadataQuery mq, RexNode outputExpression) Expression lineage from Project.getExpressionLineage(Sample rel, RelMetadataQuery mq, RexNode outputExpression) Expression lineage from Sample.getExpressionLineage(Snapshot rel, RelMetadataQuery mq, RexNode outputExpression) Expression lineage from Snapshot.getExpressionLineage(Sort rel, RelMetadataQuery mq, RexNode outputExpression) Expression lineage from Sort.getExpressionLineage(TableModify rel, RelMetadataQuery mq, RexNode outputExpression) Expression lineage from TableModify.getExpressionLineage(TableScan rel, RelMetadataQuery mq, RexNode outputExpression) Expression lineage fromTableScan.getExpressionLineage(Union rel, RelMetadataQuery mq, RexNode outputExpression) Expression lineage fromUnion.getExpressionLineage(RelNode rel, RelMetadataQuery mq, RexNode outputExpression) 
- 
Field Details- 
SOURCE
 
- 
- 
Constructor Details- 
RelMdExpressionLineageprotected RelMdExpressionLineage()
 
- 
- 
Method Details- 
getDef- Specified by:
- getDefin interface- MetadataHandler<BuiltInMetadata.ExpressionLineage>
 
- 
getExpressionLineagepublic @Nullable Set<RexNode> getExpressionLineage(RelNode rel, RelMetadataQuery mq, RexNode outputExpression) 
- 
getExpressionLineagepublic @Nullable Set<RexNode> getExpressionLineage(RelSubset rel, RelMetadataQuery mq, RexNode outputExpression) 
- 
getExpressionLineagepublic @Nullable Set<RexNode> getExpressionLineage(TableScan rel, RelMetadataQuery mq, RexNode outputExpression) Expression lineage fromTableScan.We extract the fields referenced by the expression and we express them using RexTableInputRef.
- 
getExpressionLineagepublic @Nullable Set<RexNode> getExpressionLineage(Aggregate rel, RelMetadataQuery mq, RexNode outputExpression) Expression lineage fromAggregate.If the expression references grouping sets or aggregate function results, we cannot extract the lineage and we return null. 
- 
getExpressionLineagepublic @Nullable Set<RexNode> getExpressionLineage(Join rel, RelMetadataQuery mq, RexNode outputExpression) Expression lineage fromJoin.We only extract the lineage for INNER joins. 
- 
getExpressionLineagepublic @Nullable Set<RexNode> getExpressionLineage(Union rel, RelMetadataQuery mq, RexNode outputExpression) Expression lineage fromUnion.For Union operator, we might be able to extract multiple origins for the references in the given expression. 
- 
getExpressionLineagepublic @Nullable Set<RexNode> getExpressionLineage(Project rel, RelMetadataQuery mq, RexNode outputExpression) Expression lineage from Project.
- 
getExpressionLineagepublic @Nullable Set<RexNode> getExpressionLineage(Filter rel, RelMetadataQuery mq, RexNode outputExpression) Expression lineage from Filter.
- 
getExpressionLineagepublic @Nullable Set<RexNode> getExpressionLineage(Sample rel, RelMetadataQuery mq, RexNode outputExpression) Expression lineage from Sample.
- 
getExpressionLineagepublic @Nullable Set<RexNode> getExpressionLineage(Snapshot rel, RelMetadataQuery mq, RexNode outputExpression) Expression lineage from Snapshot.- Parameters:
- rel- Snapshot relational expression
- mq- metadata query
- outputExpression- expression which needs to be inferred
- Returns:
- the inferred lineage, possibly null.
 
- 
getExpressionLineagepublic @Nullable Set<RexNode> getExpressionLineage(Sort rel, RelMetadataQuery mq, RexNode outputExpression) Expression lineage from Sort.
- 
getExpressionLineagepublic @Nullable Set<RexNode> getExpressionLineage(TableModify rel, RelMetadataQuery mq, RexNode outputExpression) Expression lineage from TableModify.
- 
getExpressionLineagepublic @Nullable Set<RexNode> getExpressionLineage(Exchange rel, RelMetadataQuery mq, RexNode outputExpression) Expression lineage from Exchange.
- 
getExpressionLineagepublic @Nullable Set<RexNode> getExpressionLineage(Calc calc, RelMetadataQuery mq, RexNode outputExpression) Expression lineage from Calc.
- 
createAllPossibleExpressionsprotected static @Nullable Set<RexNode> createAllPossibleExpressions(RexBuilder rexBuilder, RexNode expr, Map<RexInputRef, Set<RexNode>> mapping) Given an expression, it will create all equivalent expressions resulting from replacing all possible combinations of references in the mapping by the corresponding expressions.- Parameters:
- rexBuilder- rexBuilder
- expr- expression
- mapping- mapping
- Returns:
- set of resulting expressions equivalent to the input expression
 
 
-