public class RelMdCollation extends java.lang.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 | Constructor and Description |
---|---|
private |
RelMdCollation() |
Modifier and Type | Method and Description |
---|---|
static java.util.List<RelCollation> |
calc(RelMetadataQuery mq,
RelNode input,
RexProgram program)
Helper method to determine a
Calc 's collation. |
com.google.common.collect.ImmutableList<RelCollation> |
collations(Calc calc,
RelMetadataQuery mq) |
com.google.common.collect.ImmutableList<RelCollation> |
collations(EnumerableCorrelate join,
RelMetadataQuery mq) |
com.google.common.collect.ImmutableList<RelCollation> |
collations(EnumerableHashJoin join,
RelMetadataQuery mq) |
com.google.common.collect.ImmutableList<RelCollation> |
collations(EnumerableMergeJoin join,
RelMetadataQuery mq) |
com.google.common.collect.ImmutableList<RelCollation> |
collations(EnumerableNestedLoopJoin join,
RelMetadataQuery mq) |
com.google.common.collect.ImmutableList<RelCollation> |
collations(EnumerableSemiJoin join,
RelMetadataQuery mq)
Deprecated.
|
com.google.common.collect.ImmutableList<RelCollation> |
collations(Filter rel,
RelMetadataQuery mq) |
com.google.common.collect.ImmutableList<RelCollation> |
collations(HepRelVertex rel,
RelMetadataQuery mq) |
com.google.common.collect.ImmutableList<RelCollation> |
collations(Project project,
RelMetadataQuery mq) |
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. |
com.google.common.collect.ImmutableList<RelCollation> |
collations(RelSubset rel,
RelMetadataQuery mq) |
com.google.common.collect.ImmutableList<RelCollation> |
collations(SortExchange sort,
RelMetadataQuery mq) |
com.google.common.collect.ImmutableList<RelCollation> |
collations(Sort sort,
RelMetadataQuery mq) |
com.google.common.collect.ImmutableList<RelCollation> |
collations(TableScan scan,
RelMetadataQuery mq) |
com.google.common.collect.ImmutableList<RelCollation> |
collations(Values values,
RelMetadataQuery mq) |
com.google.common.collect.ImmutableList<RelCollation> |
collations(Window rel,
RelMetadataQuery mq) |
private static com.google.common.collect.Ordering<java.util.List<RexLiteral>> |
comparator(RelFieldCollation fieldCollation) |
static java.util.List<RelCollation> |
enumerableCorrelate(RelMetadataQuery mq,
RelNode left,
RelNode right,
JoinRelType joinType) |
static java.util.List<RelCollation> |
enumerableHashJoin(RelMetadataQuery mq,
RelNode left,
RelNode right,
JoinRelType joinType)
Returns the collation of
EnumerableHashJoin based on its inputs and the join type. |
private static java.util.List<RelCollation> |
enumerableJoin0(RelMetadataQuery mq,
RelNode left,
RelNode right,
JoinRelType joinType) |
static java.util.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 java.util.List<RelCollation> |
enumerableSemiJoin(RelMetadataQuery mq,
RelNode left,
RelNode right) |
static java.util.List<RelCollation> |
filter(RelMetadataQuery mq,
RelNode input)
Helper method to determine a
Filter 's collation. |
MetadataDef<BuiltInMetadata.Collation> |
getDef() |
static java.util.List<RelCollation> |
limit(RelMetadataQuery mq,
RelNode input)
Helper method to determine a
limit's collation.
|
static java.util.List<RelCollation> |
mergeJoin(RelMetadataQuery mq,
RelNode left,
RelNode right,
ImmutableIntList leftKeys,
ImmutableIntList rightKeys)
Helper method to determine a
Join 's collation assuming that it
uses a merge-join algorithm. |
static java.util.List<RelCollation> |
project(RelMetadataQuery mq,
RelNode input,
java.util.List<? extends RexNode> projects)
Helper method to determine a
Project 's collation. |
static java.util.List<RelCollation> |
snapshot(RelMetadataQuery mq,
RelNode input)
Helper method to determine a
Snapshot 's collation. |
static java.util.List<RelCollation> |
sort(RelCollation collation)
Helper method to determine a
Sort 's collation. |
static java.util.List<RelCollation> |
table(RelOptTable table)
Helper method to determine a
TableScan 's collation. |
static java.util.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 java.util.List<RelCollation> |
window(RelMetadataQuery mq,
RelNode input,
com.google.common.collect.ImmutableList<Window.Group> groups)
Helper method to determine a
Window 's collation. |
public static final RelMetadataProvider SOURCE
public MetadataDef<BuiltInMetadata.Collation> getDef()
getDef
in interface MetadataHandler<BuiltInMetadata.Collation>
public 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
,
SemiJoin
,
Correlate
do not in general return sorted results
(but implementations using particular algorithms may).
rel
- Relational expressionRelMetadataQuery.collations(RelNode)
public com.google.common.collect.ImmutableList<RelCollation> collations(Window rel, RelMetadataQuery mq)
public com.google.common.collect.ImmutableList<RelCollation> collations(Filter rel, RelMetadataQuery mq)
public com.google.common.collect.ImmutableList<RelCollation> collations(TableScan scan, RelMetadataQuery mq)
public com.google.common.collect.ImmutableList<RelCollation> collations(EnumerableMergeJoin join, RelMetadataQuery mq)
public com.google.common.collect.ImmutableList<RelCollation> collations(EnumerableHashJoin join, RelMetadataQuery mq)
public com.google.common.collect.ImmutableList<RelCollation> collations(EnumerableNestedLoopJoin join, RelMetadataQuery mq)
public com.google.common.collect.ImmutableList<RelCollation> collations(EnumerableCorrelate join, RelMetadataQuery mq)
@Deprecated public com.google.common.collect.ImmutableList<RelCollation> collations(EnumerableSemiJoin join, RelMetadataQuery mq)
public com.google.common.collect.ImmutableList<RelCollation> collations(Sort sort, RelMetadataQuery mq)
public com.google.common.collect.ImmutableList<RelCollation> collations(SortExchange sort, RelMetadataQuery mq)
public com.google.common.collect.ImmutableList<RelCollation> collations(Project project, RelMetadataQuery mq)
public com.google.common.collect.ImmutableList<RelCollation> collations(Calc calc, RelMetadataQuery mq)
public com.google.common.collect.ImmutableList<RelCollation> collations(Values values, RelMetadataQuery mq)
public com.google.common.collect.ImmutableList<RelCollation> collations(HepRelVertex rel, RelMetadataQuery mq)
public com.google.common.collect.ImmutableList<RelCollation> collations(RelSubset rel, RelMetadataQuery mq)
public static java.util.List<RelCollation> table(RelOptTable table)
TableScan
's collation.public static java.util.List<RelCollation> snapshot(RelMetadataQuery mq, RelNode input)
Snapshot
's collation.public static java.util.List<RelCollation> sort(RelCollation collation)
Sort
's collation.public static java.util.List<RelCollation> filter(RelMetadataQuery mq, RelNode input)
Filter
's collation.public static java.util.List<RelCollation> limit(RelMetadataQuery mq, RelNode input)
public static java.util.List<RelCollation> calc(RelMetadataQuery mq, RelNode input, RexProgram program)
Calc
's collation.public static java.util.List<RelCollation> project(RelMetadataQuery mq, RelNode input, java.util.List<? extends RexNode> projects)
Project
's collation.public static java.util.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 java.util.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)
.
private static com.google.common.collect.Ordering<java.util.List<RexLiteral>> comparator(RelFieldCollation fieldCollation)
public static java.util.List<RelCollation> mergeJoin(RelMetadataQuery mq, RelNode left, RelNode right, ImmutableIntList leftKeys, 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 java.util.List<RelCollation> enumerableHashJoin(RelMetadataQuery mq, RelNode left, RelNode right, JoinRelType joinType)
EnumerableHashJoin
based on its inputs and the join type.public static java.util.List<RelCollation> enumerableNestedLoopJoin(RelMetadataQuery mq, RelNode left, RelNode right, JoinRelType joinType)
EnumerableNestedLoopJoin
based on its inputs and the join type.public static java.util.List<RelCollation> enumerableCorrelate(RelMetadataQuery mq, RelNode left, RelNode right, JoinRelType joinType)
public static java.util.List<RelCollation> enumerableSemiJoin(RelMetadataQuery mq, RelNode left, RelNode right)
private static java.util.List<RelCollation> enumerableJoin0(RelMetadataQuery mq, RelNode left, RelNode right, JoinRelType joinType)
Copyright © 2012–2019 The Apache Software Foundation. All rights reserved.