|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.eigenbase.rel.metadata.RelMetadataQuery
public abstract class RelMetadataQuery
RelMetadataQuery provides a strongly-typed facade on top of RelMetadataProvider
for the set of relational expression metadata queries
defined as standard within Eigenbase. 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.
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. If your new metadata query takes parameters, be sure to register
them in the constructor via a call to ReflectiveRelMetadataProvider.mapParameterTypes(java.lang.String, java.util.List)
.
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
, prepending it to the default
providers. Then supply that instance to the planner via the appropriate
plugin mechanism.
Constructor Summary | |
---|---|
RelMetadataQuery()
|
Method Summary | |
---|---|
static Boolean |
areColumnsUnique(RelNode rel,
BitSet columns)
Determines if a specified set of columns from a specified relational expression are unique. |
static Boolean |
areColumnsUnique(RelNode rel,
BitSet columns,
boolean ignoreNulls)
Determines if a specified set of columns from a specified relational expression are unique, optionally ignoring null values in the columns. |
private static boolean |
assertNonNegative(Double result)
|
private static boolean |
assertPercentage(Double result)
|
static Set<RelColumnOrigin> |
getColumnOrigins(RelNode rel,
int iOutputColumn)
For a given output column of an expression, determines all columns of underlying tables which contribute to result values. |
static RelOptCost |
getCumulativeCost(RelNode rel)
Estimates the cost of executing a relational expression, including the cost of its inputs. |
static Double |
getDistinctRowCount(RelNode rel,
BitSet groupKey,
RexNode predicate)
Estimates the number of rows which would be produced by a GROUP BY on the set of columns indicated by groupKey, where the input to the GROUP BY has been pre-filtered by predicate. |
static RelOptCost |
getNonCumulativeCost(RelNode rel)
Estimates the cost of executing a relational expression, not counting the cost of its inputs. |
static Double |
getPercentageOriginalRows(RelNode rel)
Estimates the percentage of the number of rows actually produced by an expression out of the number of rows it would produce if all single-table filter conditions were removed. |
static Double |
getPopulationSize(RelNode rel,
BitSet groupKey)
Estimates the distinct row count in the original source for the given groupKey, ignoring any filtering being applied by the expression. |
static Double |
getRowCount(RelNode rel)
Estimates the number of rows which will be returned by a relational expression. |
static Double |
getSelectivity(RelNode rel,
RexNode predicate)
Estimates the percentage of an expression's output rows which satisfy a given predicate. |
static RelStatSource |
getStatistics(RelNode rel)
Returns statistics for a relational expression. |
static Set<BitSet> |
getUniqueKeys(RelNode rel)
Determines the set of unique minimal keys for this expression. |
static Set<BitSet> |
getUniqueKeys(RelNode rel,
boolean ignoreNulls)
Determines the set of unique minimal keys for this expression, optionally ignoring nulls in the columns in the expression. |
static boolean |
isVisibleInExplain(RelNode rel,
SqlExplainLevel explainLevel)
Determines whether a relational expression should be visible in EXPLAIN PLAN output at a particular level of detail. |
private static Double |
validateResult(Double result)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public RelMetadataQuery()
Method Detail |
---|
public static RelStatSource getStatistics(RelNode rel)
rel
- the relational expression.
public static Double getRowCount(RelNode rel)
RelNode.getRows()
, but metadata providers can override this
with their own cost models.
rel
- the relational expression
public static RelOptCost getCumulativeCost(RelNode rel)
getNonCumulativeCost(org.eigenbase.rel.RelNode)
to the cumulative cost of each input, but metadata
providers can override this with their own cost models, e.g. to take into
account interactions between expressions.
rel
- the relational expression
public static RelOptCost getNonCumulativeCost(RelNode rel)
RelNode.computeSelfCost(org.eigenbase.relopt.RelOptPlanner)
,
but metadata providers can override this with their own cost models.
rel
- the relational expression
public static Double getPercentageOriginalRows(RelNode rel)
rel
- the relational expression
public static Set<RelColumnOrigin> getColumnOrigins(RelNode rel, int iOutputColumn)
rel
- the relational expressioniOutputColumn
- 0-based ordinal for output column of interest
public static Double getSelectivity(RelNode rel, RexNode predicate)
rel
- the relational expressionpredicate
- predicate whose selectivity is to be estimated against
rel's output
public static Set<BitSet> getUniqueKeys(RelNode rel)
rel
- the relational expression
public static Set<BitSet> getUniqueKeys(RelNode rel, boolean ignoreNulls)
Nulls can be ignored if the relational expression has filtered out null values.
rel
- the relational expressionignoreNulls
- if true, ignore null values when determining
whether the keys are unique
public static Boolean areColumnsUnique(RelNode rel, BitSet columns)
rel
- the relational expressioncolumns
- column mask representing the subset of columns for which
uniqueness will be determined
public static Boolean areColumnsUnique(RelNode rel, BitSet columns, boolean ignoreNulls)
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
uniqueness
public static Double getPopulationSize(RelNode rel, BitSet groupKey)
rel
- the relational expressiongroupKey
- column mask representing the subset of columns for which
the row count will be determined
public static Double getDistinctRowCount(RelNode rel, BitSet groupKey, RexNode predicate)
rel
- the relational expressiongroupKey
- column mask representing group by columnspredicate
- pre-filtered predicates
public static boolean isVisibleInExplain(RelNode rel, SqlExplainLevel explainLevel)
rel
- the relational expressionexplainLevel
- level of detail
private static boolean assertPercentage(Double result)
private static boolean assertNonNegative(Double result)
private static Double validateResult(Double result)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |