public class FlinkRelMdCollation extends Object implements org.apache.calcite.rel.metadata.MetadataHandler<org.apache.calcite.rel.metadata.BuiltInMetadata.Collation>
RelMetadataQuery.collations(org.apache.calcite.rel.RelNode)
for the standard logical algebra.Modifier and Type | Field and Description |
---|---|
static org.apache.calcite.rel.metadata.RelMetadataProvider |
SOURCE |
Modifier and Type | Method and Description |
---|---|
static List<org.apache.calcite.rel.RelCollation> |
calc(org.apache.calcite.rel.metadata.RelMetadataQuery mq,
org.apache.calcite.rel.RelNode input,
org.apache.calcite.rex.RexProgram program)
Helper method to determine a
Calc 's collation. |
com.google.common.collect.ImmutableList<org.apache.calcite.rel.RelCollation> |
collations(org.apache.calcite.rel.core.Calc calc,
org.apache.calcite.rel.metadata.RelMetadataQuery mq) |
com.google.common.collect.ImmutableList<org.apache.calcite.rel.RelCollation> |
collations(org.apache.calcite.adapter.enumerable.EnumerableCorrelate join,
org.apache.calcite.rel.metadata.RelMetadataQuery mq) |
com.google.common.collect.ImmutableList<org.apache.calcite.rel.RelCollation> |
collations(org.apache.calcite.adapter.enumerable.EnumerableHashJoin join,
org.apache.calcite.rel.metadata.RelMetadataQuery mq) |
com.google.common.collect.ImmutableList<org.apache.calcite.rel.RelCollation> |
collations(org.apache.calcite.adapter.enumerable.EnumerableMergeJoin join,
org.apache.calcite.rel.metadata.RelMetadataQuery mq) |
com.google.common.collect.ImmutableList<org.apache.calcite.rel.RelCollation> |
collations(org.apache.calcite.adapter.enumerable.EnumerableNestedLoopJoin join,
org.apache.calcite.rel.metadata.RelMetadataQuery mq) |
com.google.common.collect.ImmutableList<org.apache.calcite.rel.RelCollation> |
collations(org.apache.calcite.rel.core.Filter rel,
org.apache.calcite.rel.metadata.RelMetadataQuery mq) |
com.google.common.collect.ImmutableList<org.apache.calcite.rel.RelCollation> |
collations(org.apache.calcite.plan.hep.HepRelVertex rel,
org.apache.calcite.rel.metadata.RelMetadataQuery mq) |
com.google.common.collect.ImmutableList<org.apache.calcite.rel.RelCollation> |
collations(org.apache.calcite.rel.core.Match rel,
org.apache.calcite.rel.metadata.RelMetadataQuery mq) |
com.google.common.collect.ImmutableList<org.apache.calcite.rel.RelCollation> |
collations(org.apache.calcite.rel.core.Project project,
org.apache.calcite.rel.metadata.RelMetadataQuery mq) |
com.google.common.collect.ImmutableList<org.apache.calcite.rel.RelCollation> |
collations(org.apache.calcite.rel.RelNode rel,
org.apache.calcite.rel.metadata.RelMetadataQuery mq)
Catch-all implementation for
BuiltInMetadata.Collation#collations() , invoked using
reflection, for any relational expression not handled by a more specific method. |
com.google.common.collect.ImmutableList<org.apache.calcite.rel.RelCollation> |
collations(org.apache.calcite.plan.volcano.RelSubset subset,
org.apache.calcite.rel.metadata.RelMetadataQuery mq) |
com.google.common.collect.ImmutableList<org.apache.calcite.rel.RelCollation> |
collations(org.apache.calcite.rel.core.SortExchange sort,
org.apache.calcite.rel.metadata.RelMetadataQuery mq) |
com.google.common.collect.ImmutableList<org.apache.calcite.rel.RelCollation> |
collations(org.apache.calcite.rel.core.Sort sort,
org.apache.calcite.rel.metadata.RelMetadataQuery mq) |
com.google.common.collect.ImmutableList<org.apache.calcite.rel.RelCollation> |
collations(org.apache.calcite.rel.core.TableModify rel,
org.apache.calcite.rel.metadata.RelMetadataQuery mq) |
com.google.common.collect.ImmutableList<org.apache.calcite.rel.RelCollation> |
collations(org.apache.calcite.rel.core.TableScan scan,
org.apache.calcite.rel.metadata.RelMetadataQuery mq) |
com.google.common.collect.ImmutableList<org.apache.calcite.rel.RelCollation> |
collations(org.apache.calcite.rel.core.Values values,
org.apache.calcite.rel.metadata.RelMetadataQuery mq) |
com.google.common.collect.ImmutableList<org.apache.calcite.rel.RelCollation> |
collations(org.apache.calcite.rel.core.Window rel,
org.apache.calcite.rel.metadata.RelMetadataQuery mq) |
static List<org.apache.calcite.rel.RelCollation> |
enumerableBatchNestedLoopJoin(org.apache.calcite.rel.metadata.RelMetadataQuery mq,
org.apache.calcite.rel.RelNode left,
org.apache.calcite.rel.RelNode right,
org.apache.calcite.rel.core.JoinRelType joinType) |
static List<org.apache.calcite.rel.RelCollation> |
enumerableCorrelate(org.apache.calcite.rel.metadata.RelMetadataQuery mq,
org.apache.calcite.rel.RelNode left,
org.apache.calcite.rel.RelNode right,
org.apache.calcite.rel.core.JoinRelType joinType) |
static List<org.apache.calcite.rel.RelCollation> |
enumerableHashJoin(org.apache.calcite.rel.metadata.RelMetadataQuery mq,
org.apache.calcite.rel.RelNode left,
org.apache.calcite.rel.RelNode right,
org.apache.calcite.rel.core.JoinRelType joinType)
Returns the collation of
EnumerableHashJoin based on its inputs and the join type. |
static List<org.apache.calcite.rel.RelCollation> |
enumerableNestedLoopJoin(org.apache.calcite.rel.metadata.RelMetadataQuery mq,
org.apache.calcite.rel.RelNode left,
org.apache.calcite.rel.RelNode right,
org.apache.calcite.rel.core.JoinRelType joinType)
Returns the collation of
EnumerableNestedLoopJoin based on its inputs and the join
type. |
static List<org.apache.calcite.rel.RelCollation> |
enumerableSemiJoin(org.apache.calcite.rel.metadata.RelMetadataQuery mq,
org.apache.calcite.rel.RelNode left,
org.apache.calcite.rel.RelNode right) |
static List<org.apache.calcite.rel.RelCollation> |
filter(org.apache.calcite.rel.metadata.RelMetadataQuery mq,
org.apache.calcite.rel.RelNode input)
Helper method to determine a
Filter 's collation. |
org.apache.calcite.rel.metadata.MetadataDef<org.apache.calcite.rel.metadata.BuiltInMetadata.Collation> |
getDef() |
static List<org.apache.calcite.rel.RelCollation> |
limit(org.apache.calcite.rel.metadata.RelMetadataQuery mq,
org.apache.calcite.rel.RelNode input)
Helper method to determine a limit's collation.
|
static List<org.apache.calcite.rel.RelCollation> |
match(org.apache.calcite.rel.metadata.RelMetadataQuery mq,
org.apache.calcite.rel.RelNode input,
org.apache.calcite.rel.type.RelDataType rowType,
org.apache.calcite.rex.RexNode pattern,
boolean strictStart,
boolean strictEnd,
Map<String,org.apache.calcite.rex.RexNode> patternDefinitions,
Map<String,org.apache.calcite.rex.RexNode> measures,
org.apache.calcite.rex.RexNode after,
Map<String,? extends SortedSet<String>> subsets,
boolean allRows,
org.apache.calcite.util.ImmutableBitSet partitionKeys,
org.apache.calcite.rel.RelCollation orderKeys,
org.apache.calcite.rex.RexNode interval)
Helper method to determine a
Match 's collation. |
static List<org.apache.calcite.rel.RelCollation> |
mergeJoin(org.apache.calcite.rel.metadata.RelMetadataQuery mq,
org.apache.calcite.rel.RelNode left,
org.apache.calcite.rel.RelNode right,
org.apache.calcite.util.ImmutableIntList leftKeys,
org.apache.calcite.util.ImmutableIntList rightKeys)
Helper method to determine a
Join 's collation assuming that it uses a merge-join
algorithm. |
static List<org.apache.calcite.rel.RelCollation> |
project(org.apache.calcite.rel.metadata.RelMetadataQuery mq,
org.apache.calcite.rel.RelNode input,
List<? extends org.apache.calcite.rex.RexNode> projects)
Helper method to determine a
Project 's collation. |
static List<org.apache.calcite.rel.RelCollation> |
snapshot(org.apache.calcite.rel.metadata.RelMetadataQuery mq,
org.apache.calcite.rel.RelNode input)
Helper method to determine a
Snapshot 's collation. |
static List<org.apache.calcite.rel.RelCollation> |
sort(org.apache.calcite.rel.RelCollation collation)
Helper method to determine a
Sort 's collation. |
static List<org.apache.calcite.rel.RelCollation> |
table(org.apache.calcite.plan.RelOptTable table)
Helper method to determine a
TableScan 's collation. |
static List<org.apache.calcite.rel.RelCollation> |
values(org.apache.calcite.rel.metadata.RelMetadataQuery mq,
org.apache.calcite.rel.type.RelDataType rowType,
com.google.common.collect.ImmutableList<com.google.common.collect.ImmutableList<org.apache.calcite.rex.RexLiteral>> tuples)
Helper method to determine a
Values 's collation. |
static List<org.apache.calcite.rel.RelCollation> |
window(org.apache.calcite.rel.metadata.RelMetadataQuery mq,
org.apache.calcite.rel.RelNode input,
com.google.common.collect.ImmutableList<org.apache.calcite.rel.core.Window.Group> groups)
Helper method to determine a
Window 's collation. |
public org.apache.calcite.rel.metadata.MetadataDef<org.apache.calcite.rel.metadata.BuiltInMetadata.Collation> getDef()
getDef
in interface org.apache.calcite.rel.metadata.MetadataHandler<org.apache.calcite.rel.metadata.BuiltInMetadata.Collation>
public com.google.common.collect.ImmutableList<org.apache.calcite.rel.RelCollation> collations(org.apache.calcite.rel.core.TableScan scan, org.apache.calcite.rel.metadata.RelMetadataQuery mq)
public com.google.common.collect.ImmutableList<org.apache.calcite.rel.RelCollation> collations(org.apache.calcite.rel.core.Values values, org.apache.calcite.rel.metadata.RelMetadataQuery mq)
public com.google.common.collect.ImmutableList<org.apache.calcite.rel.RelCollation> collations(org.apache.calcite.rel.core.Project project, org.apache.calcite.rel.metadata.RelMetadataQuery mq)
public com.google.common.collect.ImmutableList<org.apache.calcite.rel.RelCollation> collations(org.apache.calcite.rel.core.Filter rel, org.apache.calcite.rel.metadata.RelMetadataQuery mq)
public com.google.common.collect.ImmutableList<org.apache.calcite.rel.RelCollation> collations(org.apache.calcite.rel.core.Calc calc, org.apache.calcite.rel.metadata.RelMetadataQuery mq)
public com.google.common.collect.ImmutableList<org.apache.calcite.rel.RelCollation> collations(org.apache.calcite.rel.core.SortExchange sort, org.apache.calcite.rel.metadata.RelMetadataQuery mq)
public com.google.common.collect.ImmutableList<org.apache.calcite.rel.RelCollation> collations(org.apache.calcite.rel.core.Sort sort, org.apache.calcite.rel.metadata.RelMetadataQuery mq)
public com.google.common.collect.ImmutableList<org.apache.calcite.rel.RelCollation> collations(org.apache.calcite.rel.core.Window rel, org.apache.calcite.rel.metadata.RelMetadataQuery mq)
public com.google.common.collect.ImmutableList<org.apache.calcite.rel.RelCollation> collations(org.apache.calcite.adapter.enumerable.EnumerableCorrelate join, org.apache.calcite.rel.metadata.RelMetadataQuery mq)
public com.google.common.collect.ImmutableList<org.apache.calcite.rel.RelCollation> collations(org.apache.calcite.adapter.enumerable.EnumerableMergeJoin join, org.apache.calcite.rel.metadata.RelMetadataQuery mq)
public com.google.common.collect.ImmutableList<org.apache.calcite.rel.RelCollation> collations(org.apache.calcite.adapter.enumerable.EnumerableHashJoin join, org.apache.calcite.rel.metadata.RelMetadataQuery mq)
public com.google.common.collect.ImmutableList<org.apache.calcite.rel.RelCollation> collations(org.apache.calcite.adapter.enumerable.EnumerableNestedLoopJoin join, org.apache.calcite.rel.metadata.RelMetadataQuery mq)
public com.google.common.collect.ImmutableList<org.apache.calcite.rel.RelCollation> collations(org.apache.calcite.rel.core.Match rel, org.apache.calcite.rel.metadata.RelMetadataQuery mq)
public com.google.common.collect.ImmutableList<org.apache.calcite.rel.RelCollation> collations(org.apache.calcite.rel.core.TableModify rel, org.apache.calcite.rel.metadata.RelMetadataQuery mq)
public com.google.common.collect.ImmutableList<org.apache.calcite.rel.RelCollation> collations(org.apache.calcite.plan.hep.HepRelVertex rel, org.apache.calcite.rel.metadata.RelMetadataQuery mq)
public com.google.common.collect.ImmutableList<org.apache.calcite.rel.RelCollation> collations(org.apache.calcite.plan.volcano.RelSubset subset, org.apache.calcite.rel.metadata.RelMetadataQuery mq)
public com.google.common.collect.ImmutableList<org.apache.calcite.rel.RelCollation> collations(org.apache.calcite.rel.RelNode rel, org.apache.calcite.rel.metadata.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 static List<org.apache.calcite.rel.RelCollation> table(org.apache.calcite.plan.RelOptTable table)
TableScan
's collation.public static List<org.apache.calcite.rel.RelCollation> values(org.apache.calcite.rel.metadata.RelMetadataQuery mq, org.apache.calcite.rel.type.RelDataType rowType, com.google.common.collect.ImmutableList<com.google.common.collect.ImmutableList<org.apache.calcite.rex.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 List<org.apache.calcite.rel.RelCollation> project(org.apache.calcite.rel.metadata.RelMetadataQuery mq, org.apache.calcite.rel.RelNode input, List<? extends org.apache.calcite.rex.RexNode> projects)
Project
's collation.public static List<org.apache.calcite.rel.RelCollation> filter(org.apache.calcite.rel.metadata.RelMetadataQuery mq, org.apache.calcite.rel.RelNode input)
Filter
's collation.public static List<org.apache.calcite.rel.RelCollation> calc(org.apache.calcite.rel.metadata.RelMetadataQuery mq, org.apache.calcite.rel.RelNode input, org.apache.calcite.rex.RexProgram program)
Calc
's collation.public static List<org.apache.calcite.rel.RelCollation> snapshot(org.apache.calcite.rel.metadata.RelMetadataQuery mq, org.apache.calcite.rel.RelNode input)
Snapshot
's collation.public static List<org.apache.calcite.rel.RelCollation> sort(org.apache.calcite.rel.RelCollation collation)
Sort
's collation.public static List<org.apache.calcite.rel.RelCollation> limit(org.apache.calcite.rel.metadata.RelMetadataQuery mq, org.apache.calcite.rel.RelNode input)
public static List<org.apache.calcite.rel.RelCollation> window(org.apache.calcite.rel.metadata.RelMetadataQuery mq, org.apache.calcite.rel.RelNode input, com.google.common.collect.ImmutableList<org.apache.calcite.rel.core.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 List<org.apache.calcite.rel.RelCollation> match(org.apache.calcite.rel.metadata.RelMetadataQuery mq, org.apache.calcite.rel.RelNode input, org.apache.calcite.rel.type.RelDataType rowType, org.apache.calcite.rex.RexNode pattern, boolean strictStart, boolean strictEnd, Map<String,org.apache.calcite.rex.RexNode> patternDefinitions, Map<String,org.apache.calcite.rex.RexNode> measures, org.apache.calcite.rex.RexNode after, Map<String,? extends SortedSet<String>> subsets, boolean allRows, org.apache.calcite.util.ImmutableBitSet partitionKeys, org.apache.calcite.rel.RelCollation orderKeys, org.apache.calcite.rex.RexNode interval)
Match
's collation.public static List<org.apache.calcite.rel.RelCollation> mergeJoin(org.apache.calcite.rel.metadata.RelMetadataQuery mq, org.apache.calcite.rel.RelNode left, org.apache.calcite.rel.RelNode right, org.apache.calcite.util.ImmutableIntList leftKeys, org.apache.calcite.util.ImmutableIntList rightKeys)
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 List<org.apache.calcite.rel.RelCollation> enumerableHashJoin(org.apache.calcite.rel.metadata.RelMetadataQuery mq, org.apache.calcite.rel.RelNode left, org.apache.calcite.rel.RelNode right, org.apache.calcite.rel.core.JoinRelType joinType)
EnumerableHashJoin
based on its inputs and the join type.public static List<org.apache.calcite.rel.RelCollation> enumerableNestedLoopJoin(org.apache.calcite.rel.metadata.RelMetadataQuery mq, org.apache.calcite.rel.RelNode left, org.apache.calcite.rel.RelNode right, org.apache.calcite.rel.core.JoinRelType joinType)
EnumerableNestedLoopJoin
based on its inputs and the join
type.public static List<org.apache.calcite.rel.RelCollation> enumerableCorrelate(org.apache.calcite.rel.metadata.RelMetadataQuery mq, org.apache.calcite.rel.RelNode left, org.apache.calcite.rel.RelNode right, org.apache.calcite.rel.core.JoinRelType joinType)
public static List<org.apache.calcite.rel.RelCollation> enumerableSemiJoin(org.apache.calcite.rel.metadata.RelMetadataQuery mq, org.apache.calcite.rel.RelNode left, org.apache.calcite.rel.RelNode right)
public static List<org.apache.calcite.rel.RelCollation> enumerableBatchNestedLoopJoin(org.apache.calcite.rel.metadata.RelMetadataQuery mq, org.apache.calcite.rel.RelNode left, org.apache.calcite.rel.RelNode right, org.apache.calcite.rel.core.JoinRelType joinType)
Copyright © 2014–2021 The Apache Software Foundation. All rights reserved.