public class RelMetadataQuery extends RelMetadataQueryBase
RelMetadataProvider for the set of relational expression metadata
queries defined as standard within Calcite. The Javadoc on these methods
serves as their primary specification.
To add a new standard query Xyz to this interface, follow
these steps:
getXyz specification to this class.
org.apache.calcite.test.RelMetadataTest.
RelMdXyz in this package. Follow
the pattern from an existing class such as RelMdColumnOrigins,
overloading on all of the logical relational expressions to which the query
applies.
SOURCE static member, similar to
RelMdColumnOrigins.SOURCE.
SOURCE object in DefaultRelMetadataProvider.
Because relational expression metadata is extensible, extension projects
can define similar facades in order to specify access to custom metadata.
Please do not add queries here (nor on RelNode) which lack meaning
outside of your extension.
Besides adding new metadata queries, extension projects may need to add
custom providers for the standard queries in order to handle additional
relational expressions (either logical or physical). In either case, the
process is the same: write a reflective provider and chain it on to an
instance of DefaultRelMetadataProvider, pre-pending it to the default
providers. Then supply that instance to the planner via the appropriate
plugin mechanism.
map, metadataProvider, THREAD_PROVIDERS| Modifier | Constructor and Description |
|---|---|
protected |
RelMetadataQuery()
Creates the instance with
JaninoRelMetadataProvider instance
from RelMetadataQueryBase.THREAD_PROVIDERS and EMPTY as a prototype. |
clearCache, initialHandler, reviseprotected RelMetadataQuery()
JaninoRelMetadataProvider instance
from RelMetadataQueryBase.THREAD_PROVIDERS and EMPTY as a prototype.public static RelMetadataQuery instance()
public com.google.common.collect.Multimap<Class<? extends RelNode>,RelNode> getNodeTypes(RelNode rel)
BuiltInMetadata.NodeTypes.getNodeTypes()
statistic.rel - the relational expressionpublic Double getRowCount(RelNode rel)
BuiltInMetadata.RowCount.getRowCount()
statistic.rel - the relational expressionpublic Double getMaxRowCount(RelNode rel)
BuiltInMetadata.MaxRowCount.getMaxRowCount()
statistic.rel - the relational expressionpublic Double getMinRowCount(RelNode rel)
BuiltInMetadata.MinRowCount.getMinRowCount()
statistic.rel - the relational expressionpublic RelOptCost getCumulativeCost(RelNode rel)
BuiltInMetadata.CumulativeCost.getCumulativeCost()
statistic.rel - the relational expressionpublic RelOptCost getNonCumulativeCost(RelNode rel)
BuiltInMetadata.NonCumulativeCost.getNonCumulativeCost()
statistic.rel - the relational expressionpublic Double getPercentageOriginalRows(RelNode rel)
BuiltInMetadata.PercentageOriginalRows.getPercentageOriginalRows()
statistic.rel - the relational expressionpublic Set<RelColumnOrigin> getColumnOrigins(RelNode rel, int column)
BuiltInMetadata.ColumnOrigin.getColumnOrigins(int)
statistic.rel - the relational expressioncolumn - 0-based ordinal for output column of interestpublic RelColumnOrigin getColumnOrigin(RelNode rel, int column)
rel - the RelNode of the columncolumn - the offset of the column whose origin we are trying to
determinegetColumnOrigins(org.apache.calcite.rel.RelNode, int)public Set<RexNode> getExpressionLineage(RelNode rel, RexNode expression)
public Set<RexTableInputRef.RelTableRef> getTableReferences(RelNode rel)
public RelOptTable getTableOrigin(RelNode rel)
RelNode, provided it maps to a single
table, optionally with filtering and projection.rel - the RelNodepublic Double getSelectivity(RelNode rel, RexNode predicate)
BuiltInMetadata.Selectivity.getSelectivity(RexNode)
statistic.rel - the relational expressionpredicate - predicate whose selectivity is to be estimated against
rel's outputpublic Set<ImmutableBitSet> getUniqueKeys(RelNode rel)
BuiltInMetadata.UniqueKeys.getUniqueKeys(boolean)
statistic.rel - the relational expressionpublic Set<ImmutableBitSet> getUniqueKeys(RelNode rel, boolean ignoreNulls)
BuiltInMetadata.UniqueKeys.getUniqueKeys(boolean)
statistic.rel - the relational expressionignoreNulls - if true, ignore null values when determining
whether the keys are uniquepublic Boolean areRowsUnique(RelNode rel)
BuiltInMetadata.ColumnUniqueness.areColumnsUnique(org.apache.calcite.util.ImmutableBitSet, boolean)
statistic over all columns.rel - the relational expressionpublic Boolean areColumnsUnique(RelNode rel, ImmutableBitSet columns)
BuiltInMetadata.ColumnUniqueness.areColumnsUnique(ImmutableBitSet, boolean)
statistic.rel - the relational expressioncolumns - column mask representing the subset of columns for which
uniqueness will be determinedpublic Boolean areColumnsUnique(RelNode rel, ImmutableBitSet columns, boolean ignoreNulls)
BuiltInMetadata.ColumnUniqueness.areColumnsUnique(ImmutableBitSet, boolean)
statistic.rel - the relational expressioncolumns - column mask representing the subset of columns for which
uniqueness will be determinedignoreNulls - if true, ignore null values when determining column
uniquenesspublic com.google.common.collect.ImmutableList<RelCollation> collations(RelNode rel)
BuiltInMetadata.Collation.collations()
statistic.rel - the relational expressionpublic RelDistribution distribution(RelNode rel)
BuiltInMetadata.Distribution.distribution()
statistic.rel - the relational expressionpublic Double getPopulationSize(RelNode rel, ImmutableBitSet groupKey)
BuiltInMetadata.PopulationSize.getPopulationSize(ImmutableBitSet)
statistic.rel - the relational expressiongroupKey - column mask representing the subset of columns for which
the row count will be determinedpublic Double getAverageRowSize(RelNode rel)
BuiltInMetadata.Size.averageRowSize()
statistic.rel - the relational expressionpublic List<Double> getAverageColumnSizes(RelNode rel)
BuiltInMetadata.Size.averageColumnSizes()
statistic.rel - the relational expressionpublic List<Double> getAverageColumnSizesNotNull(RelNode rel)
getAverageColumnSizes(org.apache.calcite.rel.RelNode) but
never returns a null list, only ever a list of nulls.public Boolean isPhaseTransition(RelNode rel)
BuiltInMetadata.Parallelism.isPhaseTransition()
statistic.rel - the relational expressionpublic Integer splitCount(RelNode rel)
BuiltInMetadata.Parallelism.splitCount()
statistic.rel - the relational expressionpublic Double memory(RelNode rel)
BuiltInMetadata.Memory.memory()
statistic.rel - the relational expressionpublic Double cumulativeMemoryWithinPhase(RelNode rel)
BuiltInMetadata.Memory.cumulativeMemoryWithinPhase()
statistic.rel - the relational expressionpublic Double cumulativeMemoryWithinPhaseSplit(RelNode rel)
BuiltInMetadata.Memory.cumulativeMemoryWithinPhaseSplit()
statistic.rel - the relational expressionpublic Double getDistinctRowCount(RelNode rel, ImmutableBitSet groupKey, RexNode predicate)
BuiltInMetadata.DistinctRowCount.getDistinctRowCount(ImmutableBitSet, RexNode)
statistic.rel - the relational expressiongroupKey - column mask representing group by columnspredicate - pre-filtered predicatespublic RelOptPredicateList getPulledUpPredicates(RelNode rel)
BuiltInMetadata.Predicates.getPredicates()
statistic.rel - the relational expressionpublic RelOptPredicateList getAllPredicates(RelNode rel)
BuiltInMetadata.AllPredicates.getAllPredicates()
statistic.rel - the relational expressionpublic boolean isVisibleInExplain(RelNode rel, SqlExplainLevel explainLevel)
BuiltInMetadata.ExplainVisibility.isVisibleInExplain(SqlExplainLevel)
statistic.rel - the relational expressionexplainLevel - level of detailpublic RelDistribution getDistribution(RelNode rel)
BuiltInMetadata.Distribution.distribution()
statistic.rel - the relational expressionpublic RelOptCost getLowerBoundCost(RelNode rel, VolcanoPlanner planner)
Copyright © 2012-2020 Apache Software Foundation. All Rights Reserved.