Class RelMdCollation
- All Implemented Interfaces:
- MetadataHandler<BuiltInMetadata.Collation>
RelMetadataQuery.collations(org.apache.calcite.rel.RelNode)
 for the standard logical algebra.- 
Field SummaryFields
- 
Method SummaryModifier and TypeMethodDescriptionstatic @Nullable List<RelCollation>calc(RelMetadataQuery mq, RelNode input, RexProgram program) Helper method to determine aCalc's collation.@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(EnumerableLimit rel, 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>@Nullable com.google.common.collect.ImmutableList<RelCollation>@Nullable com.google.common.collect.ImmutableList<RelCollation>collations(HepRelVertex rel, RelMetadataQuery mq) @Nullable com.google.common.collect.ImmutableList<RelCollation>collations(RelSubset rel, RelMetadataQuery mq) @Nullable com.google.common.collect.ImmutableList<RelCollation>collations(Calc calc, RelMetadataQuery mq) @Nullable com.google.common.collect.ImmutableList<RelCollation>collations(Filter 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(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) @Nullable com.google.common.collect.ImmutableList<RelCollation>collations(RelNode rel, RelMetadataQuery mq) Catch-all implementation forBuiltInMetadata.Collation.collations(), invoked using reflection, for any relational expression not handled by a more specific method.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 ofEnumerableHashJoinbased on its inputs and the join type.static @Nullable List<RelCollation>enumerableNestedLoopJoin(RelMetadataQuery mq, RelNode left, RelNode right, JoinRelType joinType) Returns the collation ofEnumerableNestedLoopJoinbased 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 aFilter's 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 aMatch's collation.static @Nullable List<RelCollation>mergeJoin(RelMetadataQuery mq, RelNode left, RelNode right, ImmutableIntList leftKeys, ImmutableIntList rightKeys) Deprecated.static @Nullable List<RelCollation>mergeJoin(RelMetadataQuery mq, RelNode left, RelNode right, ImmutableIntList leftKeys, ImmutableIntList rightKeys, JoinRelType joinType) Helper method to determine aJoin'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 aProject's collation.static @Nullable List<RelCollation>snapshot(RelMetadataQuery mq, RelNode input) Helper method to determine aSnapshot's collation.static List<RelCollation>sort(RelCollation collation) Helper method to determine aSort's collation.static @Nullable List<RelCollation>table(RelOptTable table) Helper method to determine aTableScan'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 aValues's collation.static @Nullable List<RelCollation>window(RelMetadataQuery mq, RelNode input, com.google.common.collect.ImmutableList<Window.Group> groups) Helper method to determine aWindow's collation.
- 
Field Details- 
SOURCE
 
- 
- 
Method Details- 
getDef- Specified by:
- getDefin interface- MetadataHandler<BuiltInMetadata.Collation>
 
- 
collationspublic @Nullable com.google.common.collect.ImmutableList<RelCollation> collations(RelNode rel, RelMetadataQuery mq) Catch-all implementation forBuiltInMetadata.Collation.collations(), invoked using reflection, for any relational expression not handled by a more specific method.Union,Intersect,Minus,Join,Correlatedo not in general return sorted results (but implementations using particular algorithms may).- Parameters:
- rel- Relational expression
- Returns:
- Relational expression's collations
- See Also:
 
- 
collationspublic @Nullable com.google.common.collect.ImmutableList<RelCollation> collations(Window rel, RelMetadataQuery mq) 
- 
collationspublic @Nullable com.google.common.collect.ImmutableList<RelCollation> collations(Match rel, RelMetadataQuery mq) 
- 
collationspublic @Nullable com.google.common.collect.ImmutableList<RelCollation> collations(Filter rel, RelMetadataQuery mq) 
- 
collationspublic @Nullable com.google.common.collect.ImmutableList<RelCollation> collations(TableModify rel, RelMetadataQuery mq) 
- 
collationspublic @Nullable com.google.common.collect.ImmutableList<RelCollation> collations(TableScan scan, RelMetadataQuery mq) 
- 
collationspublic @Nullable com.google.common.collect.ImmutableList<RelCollation> collations(EnumerableMergeJoin join, RelMetadataQuery mq) 
- 
collationspublic @Nullable com.google.common.collect.ImmutableList<RelCollation> collations(EnumerableHashJoin join, RelMetadataQuery mq) 
- 
collationspublic @Nullable com.google.common.collect.ImmutableList<RelCollation> collations(EnumerableNestedLoopJoin join, RelMetadataQuery mq) 
- 
collationspublic @Nullable com.google.common.collect.ImmutableList<RelCollation> collations(EnumerableMergeUnion mergeUnion, RelMetadataQuery mq) 
- 
collationspublic @Nullable com.google.common.collect.ImmutableList<RelCollation> collations(EnumerableCorrelate join, RelMetadataQuery mq) 
- 
collationspublic @Nullable com.google.common.collect.ImmutableList<RelCollation> collations(EnumerableLimit rel, RelMetadataQuery mq) 
- 
collationspublic @Nullable com.google.common.collect.ImmutableList<RelCollation> collations(Sort sort, RelMetadataQuery mq) 
- 
collationspublic @Nullable com.google.common.collect.ImmutableList<RelCollation> collations(SortExchange sort, RelMetadataQuery mq) 
- 
collationspublic @Nullable com.google.common.collect.ImmutableList<RelCollation> collations(Project project, RelMetadataQuery mq) 
- 
collationspublic @Nullable com.google.common.collect.ImmutableList<RelCollation> collations(Calc calc, RelMetadataQuery mq) 
- 
collationspublic @Nullable com.google.common.collect.ImmutableList<RelCollation> collations(Values values, RelMetadataQuery mq) 
- 
collationspublic @Nullable com.google.common.collect.ImmutableList<RelCollation> collations(JdbcToEnumerableConverter rel, RelMetadataQuery mq) 
- 
collationspublic @Nullable com.google.common.collect.ImmutableList<RelCollation> collations(HepRelVertex rel, RelMetadataQuery mq) 
- 
collationspublic @Nullable com.google.common.collect.ImmutableList<RelCollation> collations(RelSubset rel, RelMetadataQuery mq) 
- 
tableHelper method to determine aTableScan's collation.
- 
snapshotHelper method to determine aSnapshot's collation.
- 
sortHelper method to determine aSort's collation.
- 
filterHelper method to determine aFilter's collation.
- 
limitHelper method to determine a limit's collation.
- 
calcpublic static @Nullable List<RelCollation> calc(RelMetadataQuery mq, RelNode input, RexProgram program) Helper method to determine aCalc's collation.
- 
projectpublic static @Nullable List<RelCollation> project(RelMetadataQuery mq, RelNode input, List<? extends RexNode> projects) Helper method to determine aProject's collation.
- 
windowpublic static @Nullable List<RelCollation> window(RelMetadataQuery mq, RelNode input, com.google.common.collect.ImmutableList<Window.Group> groups) Helper method to determine aWindow'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. 
- 
matchpublic 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 aMatch's collation.
- 
valuespublic static List<RelCollation> values(RelMetadataQuery mq, RelDataType rowType, com.google.common.collect.ImmutableList<com.google.common.collect.ImmutableList<RexLiteral>> tuples) Helper method to determine aValues'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: - produce at most N collations (where N is the number of columns);
- make each collation as long as possible;
- do not repeat combinations already emitted -
       if we've emitted (a, b)do not later emit(b, a);
- probe the actual values and make sure that each collation is consistent with the data
 So, for an empty Values with 4 columns, we would emit (a, b, c, d), (b, c, d), (c, d), (d).
- 
comparatorpublic static com.google.common.collect.Ordering<List<RexLiteral>> comparator(RelFieldCollation fieldCollation) 
- 
mergeJoin@Deprecated public static @Nullable List<RelCollation> mergeJoin(RelMetadataQuery mq, RelNode left, RelNode right, ImmutableIntList leftKeys, ImmutableIntList rightKeys) Deprecated.Helper method to determine aJoin'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. 
- 
mergeJoinpublic static @Nullable List<RelCollation> mergeJoin(RelMetadataQuery mq, RelNode left, RelNode right, ImmutableIntList leftKeys, ImmutableIntList rightKeys, JoinRelType joinType) Helper method to determine aJoin'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. 
- 
enumerableHashJoinpublic static @Nullable List<RelCollation> enumerableHashJoin(RelMetadataQuery mq, RelNode left, RelNode right, JoinRelType joinType) Returns the collation ofEnumerableHashJoinbased on its inputs and the join type.
- 
enumerableNestedLoopJoinpublic static @Nullable List<RelCollation> enumerableNestedLoopJoin(RelMetadataQuery mq, RelNode left, RelNode right, JoinRelType joinType) Returns the collation ofEnumerableNestedLoopJoinbased on its inputs and the join type.
- 
enumerableCorrelatepublic static @Nullable List<RelCollation> enumerableCorrelate(RelMetadataQuery mq, RelNode left, RelNode right, JoinRelType joinType) 
- 
enumerableSemiJoinpublic static @Nullable List<RelCollation> enumerableSemiJoin(RelMetadataQuery mq, RelNode left, RelNode right) 
- 
enumerableBatchNestedLoopJoinpublic static @Nullable List<RelCollation> enumerableBatchNestedLoopJoin(RelMetadataQuery mq, RelNode left, RelNode right, JoinRelType joinType) 
 
- 
mergeJoin(RelMetadataQuery, RelNode, RelNode, ImmutableIntList, ImmutableIntList, JoinRelType)