public class RelMdExpressionLineage extends Object implements 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.
| Modifier and Type | Field and Description |
|---|---|
static RelMetadataProvider |
SOURCE |
| Modifier | Constructor and Description |
|---|---|
protected |
RelMdExpressionLineage() |
| Modifier and Type | Method and Description |
|---|---|
protected 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.
|
MetadataDef<BuiltInMetadata.ExpressionLineage> |
getDef() |
@Nullable Set<RexNode> |
getExpressionLineage(Aggregate rel,
RelMetadataQuery mq,
RexNode outputExpression)
Expression lineage from
Aggregate. |
@Nullable Set<RexNode> |
getExpressionLineage(Calc calc,
RelMetadataQuery mq,
RexNode outputExpression)
Expression lineage from Calc.
|
@Nullable Set<RexNode> |
getExpressionLineage(Exchange rel,
RelMetadataQuery mq,
RexNode outputExpression)
Expression lineage from Exchange.
|
@Nullable Set<RexNode> |
getExpressionLineage(Filter rel,
RelMetadataQuery mq,
RexNode outputExpression)
Expression lineage from Filter.
|
@Nullable Set<RexNode> |
getExpressionLineage(Join rel,
RelMetadataQuery mq,
RexNode outputExpression)
Expression lineage from
Join. |
@Nullable Set<RexNode> |
getExpressionLineage(Project rel,
RelMetadataQuery mq,
RexNode outputExpression)
Expression lineage from Project.
|
@Nullable Set<RexNode> |
getExpressionLineage(RelNode rel,
RelMetadataQuery mq,
RexNode outputExpression) |
@Nullable Set<RexNode> |
getExpressionLineage(RelSubset rel,
RelMetadataQuery mq,
RexNode outputExpression) |
@Nullable Set<RexNode> |
getExpressionLineage(Sort rel,
RelMetadataQuery mq,
RexNode outputExpression)
Expression lineage from Sort.
|
@Nullable Set<RexNode> |
getExpressionLineage(TableModify rel,
RelMetadataQuery mq,
RexNode outputExpression)
Expression lineage from TableModify.
|
@Nullable Set<RexNode> |
getExpressionLineage(TableScan rel,
RelMetadataQuery mq,
RexNode outputExpression)
Expression lineage from
TableScan. |
@Nullable Set<RexNode> |
getExpressionLineage(Union rel,
RelMetadataQuery mq,
RexNode outputExpression)
Expression lineage from
Union. |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waithandlerMethodspublic static final RelMetadataProvider SOURCE
public MetadataDef<BuiltInMetadata.ExpressionLineage> getDef()
getDef in interface MetadataHandler<BuiltInMetadata.ExpressionLineage>public @Nullable Set<RexNode> getExpressionLineage(RelNode rel, RelMetadataQuery mq, RexNode outputExpression)
public @Nullable Set<RexNode> getExpressionLineage(RelSubset rel, RelMetadataQuery mq, RexNode outputExpression)
public @Nullable Set<RexNode> getExpressionLineage(TableScan rel, RelMetadataQuery mq, RexNode outputExpression)
TableScan.
We extract the fields referenced by the expression and we express them
using RexTableInputRef.
public @Nullable Set<RexNode> getExpressionLineage(Aggregate rel, RelMetadataQuery mq, RexNode outputExpression)
Aggregate.
If the expression references grouping sets or aggregate function results, we cannot extract the lineage and we return null.
public @Nullable Set<RexNode> getExpressionLineage(Join rel, RelMetadataQuery mq, RexNode outputExpression)
Join.
We only extract the lineage for INNER joins.
public @Nullable Set<RexNode> getExpressionLineage(Union rel, RelMetadataQuery mq, RexNode outputExpression)
Union.
For Union operator, we might be able to extract multiple origins for the references in the given expression.
public @Nullable Set<RexNode> getExpressionLineage(Project rel, RelMetadataQuery mq, RexNode outputExpression)
public @Nullable Set<RexNode> getExpressionLineage(Filter rel, RelMetadataQuery mq, RexNode outputExpression)
public @Nullable Set<RexNode> getExpressionLineage(Sort rel, RelMetadataQuery mq, RexNode outputExpression)
public @Nullable Set<RexNode> getExpressionLineage(TableModify rel, RelMetadataQuery mq, RexNode outputExpression)
public @Nullable Set<RexNode> getExpressionLineage(Exchange rel, RelMetadataQuery mq, RexNode outputExpression)
public @Nullable Set<RexNode> getExpressionLineage(Calc calc, RelMetadataQuery mq, RexNode outputExpression)
protected static @Nullable Set<RexNode> createAllPossibleExpressions(RexBuilder rexBuilder, RexNode expr, Map<RexInputRef,Set<RexNode>> mapping)
rexBuilder - rexBuilderexpr - expressionmapping - mappingCopyright © 2012-2022 Apache Software Foundation. All Rights Reserved.