public List<RelCollation> get() { // CALCITE-88 return RelMdCollation.project(cluster.getMetadataQuery(), convertChild, project.getProjects()); } });
public RelDistribution get() { return RelMdDistribution.values(rowType, tuples); } });
RelMdCollation.table(empScan.getTable()); assertThat(collations.size(), equalTo(0)); collations = RelMdCollation.sort(collation); assertThat(collations.size(), equalTo(1)); assertThat(collations.get(0).getFieldCollations().size(), equalTo(2)); collations = RelMdCollation.project(mq, empSort, projects); assertThat(collations.size(), equalTo(1)); assertThat(collations.get(0).getFieldCollations().size(), equalTo(2)); RelMdCollation.mergeJoin(mq, project, deptSort, leftKeys, rightKeys); assertThat(collations, collations = RelMdCollation.values(mq, empTable.getRowType(), ImmutableList.of()); assertThat(collations.toString(), addRow(tuples, rexBuilder, 2, 3, 2, 2); addRow(tuples, rexBuilder, 3, 3, 1, 4); collations = RelMdCollation.values(mq, rowType, tuples.build()); assertThat(collations.toString(), equalTo("[[0, 1, 2, 3], [1, 3]]"));
public ImmutableList<RelCollation> collations(EnumerableMergeJoin join, RelMetadataQuery mq) { // In general a join is not sorted. But a merge join preserves the sort // order of the left and right sides. return ImmutableList.copyOf( RelMdCollation.mergeJoin(mq, join.getLeft(), join.getRight(), join.getLeftKeys(), join.getRightKeys())); }
public ImmutableList<RelCollation> collations(Sort sort, RelMetadataQuery mq) { return ImmutableList.copyOf( RelMdCollation.sort(sort.getCollation())); }
public static EnumerableMergeJoin create(RelNode left, RelNode right, RexLiteral condition, ImmutableIntList leftKeys, ImmutableIntList rightKeys, JoinRelType joinType) throws InvalidRelException { final RelOptCluster cluster = right.getCluster(); RelTraitSet traitSet = cluster.traitSet(); if (traitSet.isEnabled(RelCollationTraitDef.INSTANCE)) { final RelMetadataQuery mq = cluster.getMetadataQuery(); final List<RelCollation> collations = RelMdCollation.mergeJoin(mq, left, right, leftKeys, rightKeys); traitSet = traitSet.replace(collations); } return new EnumerableMergeJoin(cluster, traitSet, left, right, condition, leftKeys, rightKeys, ImmutableSet.of(), joinType); }
/** Creates a BindableFilter. */ public static BindableFilter create(final RelNode input, RexNode condition) { final RelOptCluster cluster = input.getCluster(); final RelMetadataQuery mq = cluster.getMetadataQuery(); final RelTraitSet traitSet = cluster.traitSetOf(BindableConvention.INSTANCE) .replaceIfs(RelCollationTraitDef.INSTANCE, () -> RelMdCollation.filter(mq, input)); return new BindableFilter(cluster, traitSet, input, condition); }
public ImmutableList<RelCollation> collations(Calc calc, RelMetadataQuery mq) { return ImmutableList.copyOf(calc(mq, calc.getInput(), calc.getProgram())); }
public ImmutableList<RelCollation> collations(Window rel, RelMetadataQuery mq) { return ImmutableList.copyOf(window(mq, rel.getInput(), rel.groups)); }
/** Creates an EnumerableLimit. */ public static EnumerableLimit create(final RelNode input, RexNode offset, RexNode fetch) { final RelOptCluster cluster = input.getCluster(); final RelMetadataQuery mq = cluster.getMetadataQuery(); final RelTraitSet traitSet = cluster.traitSetOf(EnumerableConvention.INSTANCE) .replaceIfs( RelCollationTraitDef.INSTANCE, () -> RelMdCollation.limit(mq, input)) .replaceIf(RelDistributionTraitDef.INSTANCE, () -> RelMdDistribution.limit(mq, input)); return new EnumerableLimit(cluster, traitSet, input, offset, fetch); }
for (int j = i; j < n; j++) { final RelFieldCollation fieldCollation = new RelFieldCollation(j); Ordering<List<RexLiteral>> comparator = comparator(fieldCollation); Ordering<List<RexLiteral>> ordering; if (pairs.isEmpty()) {
RelMdCollation.table(empScan.getTable()); assertThat(collations.size(), equalTo(0)); collations = RelMdCollation.sort(collation); assertThat(collations.size(), equalTo(1)); assertThat(collations.get(0).getFieldCollations().size(), equalTo(2)); collations = RelMdCollation.project(mq, empSort, projects); assertThat(collations.size(), equalTo(1)); assertThat(collations.get(0).getFieldCollations().size(), equalTo(2)); RelMdCollation.mergeJoin(mq, project, deptSort, leftKeys, rightKeys); assertThat(collations, collations = RelMdCollation.values(mq, empTable.getRowType(), ImmutableList.of()); assertThat(collations.toString(), addRow(tuples, rexBuilder, 2, 3, 2, 2); addRow(tuples, rexBuilder, 3, 3, 1, 4); collations = RelMdCollation.values(mq, rowType, tuples.build()); assertThat(collations.toString(), equalTo("[[0, 1, 2, 3], [1, 3]]"));
public ImmutableList<RelCollation> collations(EnumerableMergeJoin join, RelMetadataQuery mq) { // In general a join is not sorted. But a merge join preserves the sort // order of the left and right sides. return ImmutableList.copyOf( RelMdCollation.mergeJoin(mq, join.getLeft(), join.getRight(), join.getLeftKeys(), join.getRightKeys())); }
public ImmutableList<RelCollation> collations(Sort sort, RelMetadataQuery mq) { return ImmutableList.copyOf( RelMdCollation.sort(sort.getCollation())); }
public static EnumerableMergeJoin create(RelNode left, RelNode right, RexLiteral condition, ImmutableIntList leftKeys, ImmutableIntList rightKeys, JoinRelType joinType) throws InvalidRelException { final RelOptCluster cluster = right.getCluster(); RelTraitSet traitSet = cluster.traitSet(); if (traitSet.isEnabled(RelCollationTraitDef.INSTANCE)) { final RelMetadataQuery mq = cluster.getMetadataQuery(); final List<RelCollation> collations = RelMdCollation.mergeJoin(mq, left, right, leftKeys, rightKeys); traitSet = traitSet.replace(collations); } return new EnumerableMergeJoin(cluster, traitSet, left, right, condition, leftKeys, rightKeys, ImmutableSet.of(), joinType); }
/** Creates a BindableFilter. */ public static BindableFilter create(final RelNode input, RexNode condition) { final RelOptCluster cluster = input.getCluster(); final RelMetadataQuery mq = cluster.getMetadataQuery(); final RelTraitSet traitSet = cluster.traitSetOf(BindableConvention.INSTANCE) .replaceIfs(RelCollationTraitDef.INSTANCE, () -> RelMdCollation.filter(mq, input)); return new BindableFilter(cluster, traitSet, input, condition); }
public ImmutableList<RelCollation> collations(Calc calc, RelMetadataQuery mq) { return ImmutableList.copyOf(calc(mq, calc.getInput(), calc.getProgram())); }
public ImmutableList<RelCollation> collations(Window rel, RelMetadataQuery mq) { return ImmutableList.copyOf(window(mq, rel.getInput(), rel.groups)); }
/** Creates an EnumerableLimit. */ public static EnumerableLimit create(final RelNode input, RexNode offset, RexNode fetch) { final RelOptCluster cluster = input.getCluster(); final RelMetadataQuery mq = cluster.getMetadataQuery(); final RelTraitSet traitSet = cluster.traitSetOf(EnumerableConvention.INSTANCE) .replaceIfs( RelCollationTraitDef.INSTANCE, () -> RelMdCollation.limit(mq, input)) .replaceIf(RelDistributionTraitDef.INSTANCE, () -> RelMdDistribution.limit(mq, input)); return new EnumerableLimit(cluster, traitSet, input, offset, fetch); }
for (int j = i; j < n; j++) { final RelFieldCollation fieldCollation = new RelFieldCollation(j); Ordering<List<RexLiteral>> comparator = comparator(fieldCollation); Ordering<List<RexLiteral>> ordering; if (pairs.isEmpty()) {