public class RelMdCollation extends Object implements MetadataHandler<BuiltInMetadata.Collation>
RelMetadataQuery.collations(org.apache.calcite.rel.RelNode)
for the standard logical algebra.| Modifier and Type | Field and Description |
|---|---|
static RelMetadataProvider |
SOURCE |
| Modifier and Type | Method and Description |
|---|---|
static @Nullable List<RelCollation> |
calc(RelMetadataQuery mq,
RelNode input,
RexProgram program)
Helper method to determine a
Calc's collation. |
@Nullable com.google.common.collect.ImmutableList<RelCollation> |
collations(Calc calc,
RelMetadataQuery mq) |
@Nullable com.google.common.collect.ImmutableList<RelCollation> |
collations(EnumerableCorrelate join,
RelMetadataQuery mq) |
@Nullable com.google.common.collect.ImmutableList<RelCollation> |
collations(EnumerableHashJoin join,
RelMetadataQuery mq) |
@Nullable com.google.common.collect.ImmutableList<RelCollation> |
collations(EnumerableMergeJoin join,
RelMetadataQuery mq) |
@Nullable com.google.common.collect.ImmutableList<RelCollation> |
collations(EnumerableMergeUnion mergeUnion,
RelMetadataQuery mq) |
@Nullable com.google.common.collect.ImmutableList<RelCollation> |
collations(EnumerableNestedLoopJoin join,
RelMetadataQuery mq) |
@Nullable com.google.common.collect.ImmutableList<RelCollation> |
collations(Filter rel,
RelMetadataQuery mq) |
@Nullable com.google.common.collect.ImmutableList<RelCollation> |
collations(HepRelVertex rel,
RelMetadataQuery mq) |
@Nullable com.google.common.collect.ImmutableList<RelCollation> |
collations(JdbcToEnumerableConverter rel,
RelMetadataQuery mq) |
@Nullable com.google.common.collect.ImmutableList<RelCollation> |
collations(Match rel,
RelMetadataQuery mq) |
@Nullable com.google.common.collect.ImmutableList<RelCollation> |
collations(Project project,
RelMetadataQuery mq) |
@Nullable com.google.common.collect.ImmutableList<RelCollation> |
collations(RelNode rel,
RelMetadataQuery mq)
Catch-all implementation for
BuiltInMetadata.Collation.collations(),
invoked using reflection, for any relational expression not
handled by a more specific method. |
@Nullable com.google.common.collect.ImmutableList<RelCollation> |
collations(RelSubset rel,
RelMetadataQuery mq) |
@Nullable com.google.common.collect.ImmutableList<RelCollation> |
collations(SortExchange sort,
RelMetadataQuery mq) |
@Nullable com.google.common.collect.ImmutableList<RelCollation> |
collations(Sort sort,
RelMetadataQuery mq) |
@Nullable com.google.common.collect.ImmutableList<RelCollation> |
collations(TableModify rel,
RelMetadataQuery mq) |
@Nullable com.google.common.collect.ImmutableList<RelCollation> |
collations(TableScan scan,
RelMetadataQuery mq) |
@Nullable com.google.common.collect.ImmutableList<RelCollation> |
collations(Values values,
RelMetadataQuery mq) |
@Nullable com.google.common.collect.ImmutableList<RelCollation> |
collations(Window rel,
RelMetadataQuery mq) |
static com.google.common.collect.Ordering<List<RexLiteral>> |
comparator(RelFieldCollation fieldCollation) |
static @Nullable List<RelCollation> |
enumerableBatchNestedLoopJoin(RelMetadataQuery mq,
RelNode left,
RelNode right,
JoinRelType joinType) |
static @Nullable List<RelCollation> |
enumerableCorrelate(RelMetadataQuery mq,
RelNode left,
RelNode right,
JoinRelType joinType) |
static @Nullable List<RelCollation> |
enumerableHashJoin(RelMetadataQuery mq,
RelNode left,
RelNode right,
JoinRelType joinType)
Returns the collation of
EnumerableHashJoin based on its inputs and the join type. |
static @Nullable List<RelCollation> |
enumerableNestedLoopJoin(RelMetadataQuery mq,
RelNode left,
RelNode right,
JoinRelType joinType)
Returns the collation of
EnumerableNestedLoopJoin
based on its inputs and the join type. |
static @Nullable List<RelCollation> |
enumerableSemiJoin(RelMetadataQuery mq,
RelNode left,
RelNode right) |
static @Nullable List<RelCollation> |
filter(RelMetadataQuery mq,
RelNode input)
Helper method to determine a
Filter's collation. |
MetadataDef<BuiltInMetadata.Collation> |
getDef() |
static @Nullable List<RelCollation> |
limit(RelMetadataQuery mq,
RelNode input)
Helper method to determine a
limit's collation.
|
static @Nullable List<RelCollation> |
match(RelMetadataQuery mq,
RelNode input,
RelDataType rowType,
RexNode pattern,
boolean strictStart,
boolean strictEnd,
Map<String,RexNode> patternDefinitions,
Map<String,RexNode> measures,
RexNode after,
Map<String,? extends SortedSet<String>> subsets,
boolean allRows,
ImmutableBitSet partitionKeys,
RelCollation orderKeys,
@Nullable RexNode interval)
Helper method to determine a
Match's collation. |
static @Nullable List<RelCollation> |
mergeJoin(RelMetadataQuery mq,
RelNode left,
RelNode right,
ImmutableIntList leftKeys,
ImmutableIntList rightKeys)
|
static @Nullable List<RelCollation> |
mergeJoin(RelMetadataQuery mq,
RelNode left,
RelNode right,
ImmutableIntList leftKeys,
ImmutableIntList rightKeys,
JoinRelType joinType)
Helper method to determine a
Join's collation assuming that it
uses a merge-join algorithm. |
static @Nullable List<RelCollation> |
project(RelMetadataQuery mq,
RelNode input,
List<? extends RexNode> projects)
Helper method to determine a
Project's collation. |
static @Nullable List<RelCollation> |
snapshot(RelMetadataQuery mq,
RelNode input)
Helper method to determine a
Snapshot's collation. |
static List<RelCollation> |
sort(RelCollation collation)
Helper method to determine a
Sort's collation. |
static @Nullable List<RelCollation> |
table(RelOptTable table)
Helper method to determine a
TableScan's collation. |
static List<RelCollation> |
values(RelMetadataQuery mq,
RelDataType rowType,
com.google.common.collect.ImmutableList<com.google.common.collect.ImmutableList<RexLiteral>> tuples)
Helper method to determine a
Values's collation. |
static @Nullable List<RelCollation> |
window(RelMetadataQuery mq,
RelNode input,
com.google.common.collect.ImmutableList<Window.Group> groups)
Helper method to determine a
Window's collation. |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waithandlerMethodspublic static final RelMetadataProvider SOURCE
public MetadataDef<BuiltInMetadata.Collation> getDef()
getDef in interface MetadataHandler<BuiltInMetadata.Collation>public @Nullable com.google.common.collect.ImmutableList<RelCollation> collations(RelNode rel, RelMetadataQuery mq)
BuiltInMetadata.Collation.collations(),
invoked using reflection, for any relational expression not
handled by a more specific method.
Union,
Intersect,
Minus,
Join,
Correlate
do not in general return sorted results
(but implementations using particular algorithms may).
rel - Relational expressionRelMetadataQuery.collations(RelNode)public @Nullable com.google.common.collect.ImmutableList<RelCollation> collations(Window rel, RelMetadataQuery mq)
public @Nullable com.google.common.collect.ImmutableList<RelCollation> collations(Match rel, RelMetadataQuery mq)
public @Nullable com.google.common.collect.ImmutableList<RelCollation> collations(Filter rel, RelMetadataQuery mq)
public @Nullable com.google.common.collect.ImmutableList<RelCollation> collations(TableModify rel, RelMetadataQuery mq)
public @Nullable com.google.common.collect.ImmutableList<RelCollation> collations(TableScan scan, RelMetadataQuery mq)
public @Nullable com.google.common.collect.ImmutableList<RelCollation> collations(EnumerableMergeJoin join, RelMetadataQuery mq)
public @Nullable com.google.common.collect.ImmutableList<RelCollation> collations(EnumerableHashJoin join, RelMetadataQuery mq)
public @Nullable com.google.common.collect.ImmutableList<RelCollation> collations(EnumerableNestedLoopJoin join, RelMetadataQuery mq)
public @Nullable com.google.common.collect.ImmutableList<RelCollation> collations(EnumerableMergeUnion mergeUnion, RelMetadataQuery mq)
public @Nullable com.google.common.collect.ImmutableList<RelCollation> collations(EnumerableCorrelate join, RelMetadataQuery mq)
public @Nullable com.google.common.collect.ImmutableList<RelCollation> collations(Sort sort, RelMetadataQuery mq)
public @Nullable com.google.common.collect.ImmutableList<RelCollation> collations(SortExchange sort, RelMetadataQuery mq)
public @Nullable com.google.common.collect.ImmutableList<RelCollation> collations(Project project, RelMetadataQuery mq)
public @Nullable com.google.common.collect.ImmutableList<RelCollation> collations(Calc calc, RelMetadataQuery mq)
public @Nullable com.google.common.collect.ImmutableList<RelCollation> collations(Values values, RelMetadataQuery mq)
public @Nullable com.google.common.collect.ImmutableList<RelCollation> collations(JdbcToEnumerableConverter rel, RelMetadataQuery mq)
public @Nullable com.google.common.collect.ImmutableList<RelCollation> collations(HepRelVertex rel, RelMetadataQuery mq)
public @Nullable com.google.common.collect.ImmutableList<RelCollation> collations(RelSubset rel, RelMetadataQuery mq)
public static @Nullable List<RelCollation> table(RelOptTable table)
TableScan's collation.public static @Nullable List<RelCollation> snapshot(RelMetadataQuery mq, RelNode input)
Snapshot's collation.public static List<RelCollation> sort(RelCollation collation)
Sort's collation.public static @Nullable List<RelCollation> filter(RelMetadataQuery mq, RelNode input)
Filter's collation.public static @Nullable List<RelCollation> limit(RelMetadataQuery mq, RelNode input)
public static @Nullable List<RelCollation> calc(RelMetadataQuery mq, RelNode input, RexProgram program)
Calc's collation.public static @Nullable List<RelCollation> project(RelMetadataQuery mq, RelNode input, List<? extends RexNode> projects)
Project's collation.public static @Nullable List<RelCollation> window(RelMetadataQuery mq, RelNode input, com.google.common.collect.ImmutableList<Window.Group> groups)
Window's collation.
A Window projects the fields of its input first, followed by the output from each of its windows. Assuming (quite reasonably) that the implementation does not re-order its input rows, then any collations of its input are preserved.
public static @Nullable List<RelCollation> match(RelMetadataQuery mq, RelNode input, RelDataType rowType, RexNode pattern, boolean strictStart, boolean strictEnd, Map<String,RexNode> patternDefinitions, Map<String,RexNode> measures, RexNode after, Map<String,? extends SortedSet<String>> subsets, boolean allRows, ImmutableBitSet partitionKeys, RelCollation orderKeys, @Nullable RexNode interval)
Match's collation.public static List<RelCollation> values(RelMetadataQuery mq, RelDataType rowType, com.google.common.collect.ImmutableList<com.google.common.collect.ImmutableList<RexLiteral>> tuples)
Values's collation.
We actually under-report the collations. A Values with 0 or 1 rows - an edge case, but legitimate and very common - is ordered by every permutation of every subset of the columns.
So, our algorithm aims to:
(a, b) do not later emit (b, a);
So, for an empty Values with 4 columns, we would emit
(a, b, c, d), (b, c, d), (c, d), (d).
public static com.google.common.collect.Ordering<List<RexLiteral>> comparator(RelFieldCollation fieldCollation)
@Deprecated public static @Nullable List<RelCollation> mergeJoin(RelMetadataQuery mq, RelNode left, RelNode right, ImmutableIntList leftKeys, ImmutableIntList rightKeys)
mergeJoin(RelMetadataQuery, RelNode, RelNode, ImmutableIntList, ImmutableIntList, JoinRelType)Join's collation assuming that it
uses a merge-join algorithm.
If the inputs are sorted on other keys in addition to the join key, the result preserves those collations too.
public static @Nullable List<RelCollation> mergeJoin(RelMetadataQuery mq, RelNode left, RelNode right, ImmutableIntList leftKeys, ImmutableIntList rightKeys, JoinRelType joinType)
Join's collation assuming that it
uses a merge-join algorithm.
If the inputs are sorted on other keys in addition to the join key, the result preserves those collations too.
public static @Nullable List<RelCollation> enumerableHashJoin(RelMetadataQuery mq, RelNode left, RelNode right, JoinRelType joinType)
EnumerableHashJoin based on its inputs and the join type.public static @Nullable List<RelCollation> enumerableNestedLoopJoin(RelMetadataQuery mq, RelNode left, RelNode right, JoinRelType joinType)
EnumerableNestedLoopJoin
based on its inputs and the join type.public static @Nullable List<RelCollation> enumerableCorrelate(RelMetadataQuery mq, RelNode left, RelNode right, JoinRelType joinType)
public static @Nullable List<RelCollation> enumerableSemiJoin(RelMetadataQuery mq, RelNode left, RelNode right)
public static @Nullable List<RelCollation> enumerableBatchNestedLoopJoin(RelMetadataQuery mq, RelNode left, RelNode right, JoinRelType joinType)
Copyright © 2012-2022 Apache Software Foundation. All Rights Reserved.