public class RelMdCollation extends Object
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 List<RelCollation> |
calc(RelNode input,
RexProgram program)
Helper method to determine a
Calc's collation. |
com.google.common.collect.ImmutableList<RelCollation> |
collations(EnumerableMergeJoin join) |
com.google.common.collect.ImmutableList<RelCollation> |
collations(Filter rel) |
com.google.common.collect.ImmutableList<RelCollation> |
collations(HepRelVertex rel) |
com.google.common.collect.ImmutableList<RelCollation> |
collations(Project project) |
com.google.common.collect.ImmutableList<RelCollation> |
collations(RelNode rel)
Fallback method to deduce collations for any relational expression not
handled by a more specific method.
|
com.google.common.collect.ImmutableList<RelCollation> |
collations(RelSubset rel) |
com.google.common.collect.ImmutableList<RelCollation> |
collations(Sort sort) |
com.google.common.collect.ImmutableList<RelCollation> |
collations(SortExchange sort) |
com.google.common.collect.ImmutableList<RelCollation> |
collations(TableScan scan) |
com.google.common.collect.ImmutableList<RelCollation> |
collations(Values values) |
com.google.common.collect.ImmutableList<RelCollation> |
collations(Window rel) |
static List<RelCollation> |
filter(RelNode input)
Helper method to determine a
Filter's collation. |
static List<RelCollation> |
limit(RelNode input)
Helper method to determine a
limit's collation.
|
static List<RelCollation> |
mergeJoin(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 List<RelCollation> |
project(RelNode input,
List<? extends RexNode> projects)
Helper method to determine a
Project's collation. |
static List<RelCollation> |
sort(RelCollation collation)
Helper method to determine a
Sort's collation. |
static List<RelCollation> |
table(RelOptTable table)
Helper method to determine a
TableScan's collation. |
static List<RelCollation> |
values(RelDataType rowType,
com.google.common.collect.ImmutableList<com.google.common.collect.ImmutableList<RexLiteral>> tuples)
Helper method to determine a
Values's collation. |
static List<RelCollation> |
window(RelNode input,
com.google.common.collect.ImmutableList<Window.Group> groups)
Helper method to determine a
Window's collation. |
public static final RelMetadataProvider SOURCE
public com.google.common.collect.ImmutableList<RelCollation> collations(RelNode rel)
Union,
Intersect,
Minus,
Join,
SemiJoin,
Correlate
do not in general return sorted results
(but implementations using particular algorithms may).
rel - Relational expressionpublic com.google.common.collect.ImmutableList<RelCollation> collations(Window rel)
public com.google.common.collect.ImmutableList<RelCollation> collations(Filter rel)
public com.google.common.collect.ImmutableList<RelCollation> collations(TableScan scan)
public com.google.common.collect.ImmutableList<RelCollation> collations(EnumerableMergeJoin join)
public com.google.common.collect.ImmutableList<RelCollation> collations(Sort sort)
public com.google.common.collect.ImmutableList<RelCollation> collations(SortExchange sort)
public com.google.common.collect.ImmutableList<RelCollation> collations(Project project)
public com.google.common.collect.ImmutableList<RelCollation> collations(Values values)
public com.google.common.collect.ImmutableList<RelCollation> collations(HepRelVertex rel)
public com.google.common.collect.ImmutableList<RelCollation> collations(RelSubset rel)
public static List<RelCollation> table(RelOptTable table)
TableScan's collation.public static List<RelCollation> sort(RelCollation collation)
Sort's collation.public static List<RelCollation> filter(RelNode input)
Filter's collation.public static List<RelCollation> limit(RelNode input)
public static List<RelCollation> calc(RelNode input, RexProgram program)
Calc's collation.public static List<RelCollation> project(RelNode input, List<? extends RexNode> projects)
Project's collation.public static List<RelCollation> window(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 List<RelCollation> values(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 List<RelCollation> mergeJoin(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.
Copyright © 2012–2015 The Apache Software Foundation. All rights reserved.