org.apache.calcite.rel.RelDistributions Java Examples

The following examples show how to use org.apache.calcite.rel.RelDistributions. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: RelFieldTrimmerTest.java    From calcite with Apache License 2.0 6 votes vote down vote up
@Test void testCalcFieldTrimmer0() {
  final RelBuilder builder = RelBuilder.create(config().build());
  final RelNode root =
      builder.scan("EMP")
          .project(builder.field("EMPNO"), builder.field("ENAME"), builder.field("DEPTNO"))
          .exchange(RelDistributions.SINGLETON)
          .project(builder.field("EMPNO"), builder.field("ENAME"))
          .build();

  final HepProgram hepProgram = new HepProgramBuilder().
      addRuleInstance(ProjectToCalcRule.INSTANCE).build();

  final HepPlanner hepPlanner = new HepPlanner(hepProgram);
  hepPlanner.setRoot(root);
  final RelNode relNode = hepPlanner.findBestExp();
  final RelFieldTrimmer fieldTrimmer = new RelFieldTrimmer(null, builder);
  final RelNode trimmed = fieldTrimmer.trim(relNode);

  final String expected = ""
      + "LogicalCalc(expr#0..1=[{inputs}], proj#0..1=[{exprs}])\n"
      + "  LogicalExchange(distribution=[single])\n"
      + "    LogicalCalc(expr#0..1=[{inputs}], proj#0..1=[{exprs}])\n"
      + "      LogicalProject(EMPNO=[$0], ENAME=[$1])\n"
      + "        LogicalTableScan(table=[[scott, EMP]])\n";
  assertThat(trimmed, hasTree(expected));
}
 
Example #2
Source File: RelFieldTrimmerTest.java    From calcite with Apache License 2.0 6 votes vote down vote up
@Test void testExchangeFieldTrimmerWithSingletonDistribution() {
  final RelBuilder builder = RelBuilder.create(config().build());
  final RelNode root =
      builder.scan("EMP")
          .project(builder.field("EMPNO"), builder.field("ENAME"), builder.field("DEPTNO"))
          .exchange(RelDistributions.SINGLETON)
          .project(builder.field("EMPNO"), builder.field("ENAME"))
          .build();

  final RelFieldTrimmer fieldTrimmer = new RelFieldTrimmer(null, builder);
  final RelNode trimmed = fieldTrimmer.trim(root);

  final String expected = ""
      + "LogicalExchange(distribution=[single])\n"
      + "  LogicalProject(EMPNO=[$0], ENAME=[$1])\n"
      + "    LogicalTableScan(table=[[scott, EMP]])\n";
  assertThat(trimmed, hasTree(expected));
}
 
Example #3
Source File: RelFieldTrimmerTest.java    From calcite with Apache License 2.0 6 votes vote down vote up
@Test void testExchangeFieldTrimmerWhenProjectCannotBeMerged() {
  final RelBuilder builder = RelBuilder.create(config().build());
  final RelNode root =
      builder.scan("EMP")
          .project(builder.field("EMPNO"), builder.field("ENAME"), builder.field("DEPTNO"))
          .exchange(RelDistributions.hash(Lists.newArrayList(1)))
          .project(builder.field("EMPNO"))
          .build();

  final RelFieldTrimmer fieldTrimmer = new RelFieldTrimmer(null, builder);
  final RelNode trimmed = fieldTrimmer.trim(root);

  final String expected = ""
      + "LogicalProject(EMPNO=[$0])\n"
      + "  LogicalExchange(distribution=[hash[1]])\n"
      + "    LogicalProject(EMPNO=[$0], ENAME=[$1])\n"
      + "      LogicalTableScan(table=[[scott, EMP]])\n";
  assertThat(trimmed, hasTree(expected));
}
 
Example #4
Source File: RelMetadataTest.java    From calcite with Apache License 2.0 6 votes vote down vote up
@Test void testNodeTypeCountExchange() {

    final RelNode rel = convertSql("select * from emp");
    final RelDistribution dist = RelDistributions.hash(ImmutableList.<Integer>of());
    final LogicalExchange exchange = LogicalExchange.create(rel, dist);

    final Map<Class<? extends RelNode>, Integer> expected = new HashMap<>();
    expected.put(TableScan.class, 1);
    expected.put(Exchange.class, 1);
    expected.put(Project.class, 1);

    final RelMetadataQuery mq = rel.getCluster().getMetadataQuery();
    final Multimap<Class<? extends RelNode>, RelNode> result = mq.getNodeTypes(exchange);
    assertThat(result, notNullValue());
    final Map<Class<? extends RelNode>, Integer> resultCount = new HashMap<>();
    for (Entry<Class<? extends RelNode>, Collection<RelNode>> e : result.asMap().entrySet()) {
      resultCount.put(e.getKey(), e.getValue().size());
    }
    assertThat(expected, equalTo(resultCount));
  }
 
Example #5
Source File: RelFieldTrimmerTest.java    From calcite with Apache License 2.0 6 votes vote down vote up
@Test void testExchangeFieldTrimmer() {
  final RelBuilder builder = RelBuilder.create(config().build());
  final RelNode root =
      builder.scan("EMP")
          .project(builder.field("EMPNO"), builder.field("ENAME"), builder.field("DEPTNO"))
          .exchange(RelDistributions.hash(Lists.newArrayList(1)))
          .project(builder.field("EMPNO"), builder.field("ENAME"))
          .build();

  final RelFieldTrimmer fieldTrimmer = new RelFieldTrimmer(null, builder);
  final RelNode trimmed = fieldTrimmer.trim(root);

  final String expected = ""
      + "LogicalExchange(distribution=[hash[1]])\n"
      + "  LogicalProject(EMPNO=[$0], ENAME=[$1])\n"
      + "    LogicalTableScan(table=[[scott, EMP]])\n";
  assertThat(trimmed, hasTree(expected));
}
 
Example #6
Source File: RelJson.java    From calcite with Apache License 2.0 6 votes vote down vote up
public RelDistribution toDistribution(Map<String, Object> map) {
  final RelDistribution.Type type =
      Util.enumVal(RelDistribution.Type.class,
          (String) map.get("type"));

  ImmutableIntList list = EMPTY;
  if (map.containsKey("keys")) {
    List<Object> keysJson = (List<Object>) map.get("keys");
    ArrayList<Integer> keys = new ArrayList<>(keysJson.size());
    for (Object o : keysJson) {
      keys.add((Integer) o);
    }
    list = ImmutableIntList.copyOf(keys);
  }
  return RelDistributions.of(type, list);
}
 
Example #7
Source File: RelFieldTrimmerTest.java    From calcite with Apache License 2.0 6 votes vote down vote up
@Test void testSortExchangeFieldTrimmerWithSingletonDistribution() {
  final RelBuilder builder = RelBuilder.create(config().build());
  final RelNode root =
      builder.scan("EMP")
          .project(builder.field("EMPNO"), builder.field("ENAME"), builder.field("DEPTNO"))
          .sortExchange(RelDistributions.SINGLETON, RelCollations.of(0))
          .project(builder.field("EMPNO"), builder.field("ENAME"))
          .build();

  RelFieldTrimmer fieldTrimmer = new RelFieldTrimmer(null, builder);
  RelNode trimmed = fieldTrimmer.trim(root);

  final String expected = ""
      + "LogicalSortExchange(distribution=[single], collation=[[0]])\n"
      + "  LogicalProject(EMPNO=[$0], ENAME=[$1])\n"
      + "    LogicalTableScan(table=[[scott, EMP]])\n";
  assertThat(trimmed, hasTree(expected));
}
 
Example #8
Source File: RelFieldTrimmerTest.java    From calcite with Apache License 2.0 6 votes vote down vote up
@Test void testSortExchangeFieldTrimmerWithEmptyCollation() {
  final RelBuilder builder = RelBuilder.create(config().build());
  final RelNode root =
      builder.scan("EMP")
          .project(builder.field("EMPNO"), builder.field("ENAME"), builder.field("DEPTNO"))
          .sortExchange(RelDistributions.hash(Lists.newArrayList(1)), RelCollations.EMPTY)
          .project(builder.field("EMPNO"), builder.field("ENAME"))
          .build();

  RelFieldTrimmer fieldTrimmer = new RelFieldTrimmer(null, builder);
  RelNode trimmed = fieldTrimmer.trim(root);

  final String expected = ""
      + "LogicalSortExchange(distribution=[hash[1]], collation=[[]])\n"
      + "  LogicalProject(EMPNO=[$0], ENAME=[$1])\n"
      + "    LogicalTableScan(table=[[scott, EMP]])\n";
  assertThat(trimmed, hasTree(expected));
}
 
Example #9
Source File: RelFieldTrimmerTest.java    From calcite with Apache License 2.0 6 votes vote down vote up
@Test void testSortExchangeFieldTrimmerWhenProjectCannotBeMerged() {
  final RelBuilder builder = RelBuilder.create(config().build());
  final RelNode root =
      builder.scan("EMP")
          .project(builder.field("EMPNO"), builder.field("ENAME"), builder.field("DEPTNO"))
          .sortExchange(RelDistributions.hash(Lists.newArrayList(1)), RelCollations.of(0))
          .project(builder.field("EMPNO"))
          .build();

  RelFieldTrimmer fieldTrimmer = new RelFieldTrimmer(null, builder);
  RelNode trimmed = fieldTrimmer.trim(root);

  final String expected = ""
      + "LogicalProject(EMPNO=[$0])\n"
      + "  LogicalSortExchange(distribution=[hash[1]], collation=[[0]])\n"
      + "    LogicalProject(EMPNO=[$0], ENAME=[$1])\n"
      + "      LogicalTableScan(table=[[scott, EMP]])\n";
  assertThat(trimmed, hasTree(expected));
}
 
Example #10
Source File: RelFieldTrimmerTest.java    From calcite with Apache License 2.0 6 votes vote down vote up
@Test void testSortExchangeFieldTrimmer() {
  final RelBuilder builder = RelBuilder.create(config().build());
  final RelNode root =
      builder.scan("EMP")
          .project(builder.field("EMPNO"), builder.field("ENAME"), builder.field("DEPTNO"))
          .sortExchange(RelDistributions.hash(Lists.newArrayList(1)), RelCollations.of(0))
          .project(builder.field("EMPNO"), builder.field("ENAME"))
          .build();

  RelFieldTrimmer fieldTrimmer = new RelFieldTrimmer(null, builder);
  RelNode trimmed = fieldTrimmer.trim(root);

  final String expected = ""
      + "LogicalSortExchange(distribution=[hash[1]], collation=[[0]])\n"
      + "  LogicalProject(EMPNO=[$0], ENAME=[$1])\n"
      + "    LogicalTableScan(table=[[scott, EMP]])\n";
  assertThat(trimmed, hasTree(expected));
}
 
Example #11
Source File: RelMetadataTest.java    From calcite with Apache License 2.0 5 votes vote down vote up
@Test void testRowCountExchange() {
  final String sql = "select * from emp order by ename limit 123456";
  RelNode rel = convertSql(sql);
  final RelDistribution dist = RelDistributions.hash(ImmutableList.<Integer>of());
  final LogicalExchange exchange = LogicalExchange.create(rel, dist);
  checkExchangeRowCount(exchange, EMP_SIZE, 0D, 123456D);
}
 
Example #12
Source File: RelFieldTrimmerTest.java    From calcite with Apache License 2.0 5 votes vote down vote up
@Test void testCalcFieldTrimmer2() {
  final RelBuilder builder = RelBuilder.create(config().build());
  final RelNode root =
      builder.scan("EMP")
          .project(builder.field("EMPNO"), builder.field("ENAME"), builder.field("DEPTNO"))
          .exchange(RelDistributions.SINGLETON)
          .filter(
              builder.call(SqlStdOperatorTable.GREATER_THAN,
                  builder.field("EMPNO"), builder.literal(100)))
          .project(builder.field("EMPNO"), builder.field("ENAME"))
          .build();

  final HepProgram hepProgram = new HepProgramBuilder()
      .addRuleInstance(ProjectToCalcRule.INSTANCE)
      .addRuleInstance(FilterToCalcRule.INSTANCE)
      .addRuleInstance(CalcMergeRule.INSTANCE).build();

  final HepPlanner hepPlanner = new HepPlanner(hepProgram);
  hepPlanner.setRoot(root);
  final RelNode relNode = hepPlanner.findBestExp();
  final RelFieldTrimmer fieldTrimmer = new RelFieldTrimmer(null, builder);
  final RelNode trimmed = fieldTrimmer.trim(relNode);

  final String expected = ""
      + "LogicalCalc(expr#0..1=[{inputs}], expr#2=[100], expr#3=[>($t0, $t2)], proj#0."
      + ".1=[{exprs}], $condition=[$t3])\n"
      + "  LogicalExchange(distribution=[single])\n"
      + "    LogicalCalc(expr#0..1=[{inputs}], proj#0..1=[{exprs}])\n"
      + "      LogicalProject(EMPNO=[$0], ENAME=[$1])\n"
      + "        LogicalTableScan(table=[[scott, EMP]])\n";
  assertThat(trimmed, hasTree(expected));
}
 
Example #13
Source File: RelWriterTest.java    From calcite with Apache License 2.0 5 votes vote down vote up
@Test void testWriteSortExchangeWithRandomDistribution() {
  final RelNode root = createSortPlan(RelDistributions.RANDOM_DISTRIBUTED);
  final RelJsonWriter writer = new RelJsonWriter();
  root.explain(writer);
  final String json = writer.asString();
  final String s = deserializeAndDumpToTextFormat(getSchema(root), json);
  final String expected =
      "LogicalSortExchange(distribution=[random], collation=[[0]])\n"
          + "  LogicalTableScan(table=[[scott, EMP]])\n";
  assertThat(s, isLinux(expected));
}
 
Example #14
Source File: RelMetadataTest.java    From calcite with Apache License 2.0 5 votes vote down vote up
@Test void testColumnUniquenessForExchangeWithConstantColumns() {
  final FrameworkConfig config = RelBuilderTest.config().build();
  final RelBuilder builder = RelBuilder.create(config);
  RelNode exchange = builder.scan("EMP")
      .project(builder.field("DEPTNO"), builder.field("SAL"))
      .distinct()
      .filter(builder.equals(builder.field("SAL"), builder.literal(1)))
      .exchange(RelDistributions.hash(ImmutableList.of(1)))
      .build();
  final RelMetadataQuery mq = exchange.getCluster().getMetadataQuery();
  assertThat(mq.areColumnsUnique(exchange, ImmutableBitSet.of(0)), is(true));
}
 
Example #15
Source File: RelMetadataTest.java    From calcite with Apache License 2.0 5 votes vote down vote up
@Test void testDistributionHash() {
  final RelNode rel = convertSql("select * from emp");
  final RelDistribution dist = RelDistributions.hash(ImmutableList.of(1));
  final LogicalExchange exchange = LogicalExchange.create(rel, dist);

  final RelMetadataQuery mq = rel.getCluster().getMetadataQuery();
  RelDistribution d = mq.getDistribution(exchange);
  assertThat(d, is(dist));
}
 
Example #16
Source File: RelMetadataTest.java    From calcite with Apache License 2.0 5 votes vote down vote up
@Test void testDistributionHashEmpty() {
  final RelNode rel = convertSql("select * from emp");
  final RelDistribution dist = RelDistributions.hash(ImmutableList.<Integer>of());
  final LogicalExchange exchange = LogicalExchange.create(rel, dist);

  final RelMetadataQuery mq = rel.getCluster().getMetadataQuery();
  RelDistribution d = mq.getDistribution(exchange);
  assertThat(d, is(dist));
}
 
Example #17
Source File: RelMetadataTest.java    From calcite with Apache License 2.0 5 votes vote down vote up
@Test void testDistributionSingleton() {
  final RelNode rel = convertSql("select * from emp");
  final RelDistribution dist = RelDistributions.SINGLETON;
  final LogicalExchange exchange = LogicalExchange.create(rel, dist);

  final RelMetadataQuery mq = rel.getCluster().getMetadataQuery();
  RelDistribution d = mq.getDistribution(exchange);
  assertThat(d, is(dist));
}
 
Example #18
Source File: RelBuilderTest.java    From calcite with Apache License 2.0 5 votes vote down vote up
@Test void testExchange() {
  final RelBuilder builder = RelBuilder.create(config().build());
  final RelNode root = builder.scan("EMP")
      .exchange(RelDistributions.hash(Lists.newArrayList(0)))
      .build();
  final String expected =
      "LogicalExchange(distribution=[hash[0]])\n"
          + "  LogicalTableScan(table=[[scott, EMP]])\n";
  assertThat(root, hasTree(expected));
}
 
Example #19
Source File: RelBuilderTest.java    From calcite with Apache License 2.0 5 votes vote down vote up
@Test void testSortExchange() {
  final RelBuilder builder = RelBuilder.create(config().build());
  final RelNode root =
      builder.scan("EMP")
          .sortExchange(RelDistributions.hash(Lists.newArrayList(0)),
              RelCollations.of(0))
          .build();
  final String expected =
      "LogicalSortExchange(distribution=[hash[0]], collation=[[0]])\n"
          + "  LogicalTableScan(table=[[scott, EMP]])\n";
  assertThat(root, hasTree(expected));
}
 
Example #20
Source File: RelWriterTest.java    From calcite with Apache License 2.0 5 votes vote down vote up
@Test void testWriteSortExchangeWithHashDistribution() {
  final RelNode root = createSortPlan(RelDistributions.hash(Lists.newArrayList(0)));
  final RelJsonWriter writer = new RelJsonWriter();
  root.explain(writer);
  final String json = writer.asString();
  assertThat(json, is(XX3));

  final String s = deserializeAndDumpToTextFormat(getSchema(root), json);
  final String expected =
      "LogicalSortExchange(distribution=[hash[0]], collation=[[0]])\n"
          + "  LogicalTableScan(table=[[scott, EMP]])\n";
  assertThat(s, isLinux(expected));
}
 
Example #21
Source File: RelFieldTrimmerTest.java    From calcite with Apache License 2.0 5 votes vote down vote up
@Test void testCalcFieldTrimmer1() {
  final RelBuilder builder = RelBuilder.create(config().build());
  final RelNode root =
      builder.scan("EMP")
          .project(builder.field("EMPNO"), builder.field("ENAME"), builder.field("DEPTNO"))
          .exchange(RelDistributions.SINGLETON)
          .filter(
              builder.call(SqlStdOperatorTable.GREATER_THAN,
                  builder.field("EMPNO"), builder.literal(100)))
          .build();

  final HepProgram hepProgram = new HepProgramBuilder()
      .addRuleInstance(ProjectToCalcRule.INSTANCE)
      .addRuleInstance(FilterToCalcRule.INSTANCE)
      .build();

  final HepPlanner hepPlanner = new HepPlanner(hepProgram);
  hepPlanner.setRoot(root);
  final RelNode relNode = hepPlanner.findBestExp();
  final RelFieldTrimmer fieldTrimmer = new RelFieldTrimmer(null, builder);
  final RelNode trimmed = fieldTrimmer.trim(relNode);

  final String expected = ""
      + "LogicalCalc(expr#0..2=[{inputs}], expr#3=[100], expr#4=[>($t0, $t3)], proj#0."
      + ".2=[{exprs}], $condition=[$t4])\n"
      + "  LogicalExchange(distribution=[single])\n"
      + "    LogicalCalc(expr#0..2=[{inputs}], proj#0..2=[{exprs}])\n"
      + "      LogicalProject(EMPNO=[$0], ENAME=[$1], DEPTNO=[$7])\n"
      + "        LogicalTableScan(table=[[scott, EMP]])\n";
  assertThat(trimmed, hasTree(expected));
}
 
Example #22
Source File: ExchangeRemoveConstantKeysRule.java    From calcite with Apache License 2.0 5 votes vote down vote up
@Override public void onMatch(RelOptRuleCall call) {
  final Exchange exchange = call.rel(0);
  final RelMetadataQuery mq = call.getMetadataQuery();
  final RelNode input = exchange.getInput();
  final RelOptPredicateList predicates = mq.getPulledUpPredicates(input);
  if (predicates == null) {
    return;
  }

  final Set<Integer> constants = new HashSet<>();
  predicates.constantMap.keySet().forEach(key -> {
    if (key instanceof RexInputRef) {
      constants.add(((RexInputRef) key).getIndex());
    }
  });
  if (constants.isEmpty()) {
    return;
  }

  final List<Integer> distributionKeys = simplifyDistributionKeys(
      exchange.getDistribution(), constants);

  if (distributionKeys.size() != exchange.getDistribution().getKeys()
      .size()) {
    call.transformTo(call.builder()
        .push(exchange.getInput())
        .exchange(distributionKeys.isEmpty()
            ? RelDistributions.SINGLETON
            : RelDistributions.hash(distributionKeys))
        .build());
    call.getPlanner().prune(exchange);
  }
}
 
Example #23
Source File: RelTraitSerializers.java    From dremio-oss with Apache License 2.0 5 votes vote down vote up
public static void register(final Kryo kryo) {
  final EnumSerializer enumSerializer = new EnumSerializer();
  kryo.addDefaultSerializer(BindableConvention.class, enumSerializer);
  kryo.addDefaultSerializer(EnumerableConvention.class, enumSerializer);
  kryo.addDefaultSerializer(InterpretableConvention.class, enumSerializer);
  kryo.addDefaultSerializer(Convention.Impl.class, ConventionSerializer.class);

  kryo.addDefaultSerializer(RelDistributions.SINGLETON.getClass(), RelDistributionSerializer.class);
  kryo.addDefaultSerializer(DistributionTrait.class, DistributionTraitSerializer.class);
  kryo.addDefaultSerializer(RelCollation.class, RelCollationSerializer.class);

  kryo.addDefaultSerializer(RelTraitSet.class, RelTraitSetSerializer.class);
}
 
Example #24
Source File: RelOptAbstractTable.java    From calcite with Apache License 2.0 4 votes vote down vote up
public RelDistribution getDistribution() {
  return RelDistributions.BROADCAST_DISTRIBUTED;
}
 
Example #25
Source File: SqlToRelTestBase.java    From calcite with Apache License 2.0 4 votes vote down vote up
public RelDistribution getDistribution() {
  return RelDistributions.BROADCAST_DISTRIBUTED;
}
 
Example #26
Source File: MockCatalogReader.java    From calcite with Apache License 2.0 4 votes vote down vote up
public RelDistribution getDistribution() {
  return RelDistributions.BROADCAST_DISTRIBUTED;
}
 
Example #27
Source File: ExchangeRemoveConstantKeysRule.java    From calcite with Apache License 2.0 4 votes vote down vote up
@Override public void onMatch(RelOptRuleCall call) {
  final SortExchange sortExchange = call.rel(0);
  final RelMetadataQuery mq = call.getMetadataQuery();
  final RelNode input = sortExchange.getInput();
  final RelOptPredicateList predicates = mq.getPulledUpPredicates(input);
  if (predicates == null) {
    return;
  }

  final Set<Integer> constants = new HashSet<>();
  predicates.constantMap.keySet().forEach(key -> {
    if (key instanceof RexInputRef) {
      constants.add(((RexInputRef) key).getIndex());
    }
  });

  if (constants.isEmpty()) {
    return;
  }

  List<Integer> distributionKeys = new ArrayList<>();
  boolean distributionSimplified = false;
  boolean hashDistribution = sortExchange.getDistribution().getType()
      == RelDistribution.Type.HASH_DISTRIBUTED;
  if (hashDistribution) {
    distributionKeys = simplifyDistributionKeys(
        sortExchange.getDistribution(), constants);
    distributionSimplified =
        distributionKeys.size() != sortExchange.getDistribution().getKeys()
            .size();
  }

  final List<RelFieldCollation> fieldCollations = sortExchange
      .getCollation().getFieldCollations().stream().filter(
          fc -> !constants.contains(fc.getFieldIndex()))
       .collect(Collectors.toList());

  boolean collationSimplified =
       fieldCollations.size() != sortExchange.getCollation()
           .getFieldCollations().size();
  if (distributionSimplified
       || collationSimplified) {
    RelDistribution distribution = distributionSimplified
        ? (distributionKeys.isEmpty()
            ? RelDistributions.SINGLETON
            : RelDistributions.hash(distributionKeys))
        : sortExchange.getDistribution();
    RelCollation collation = collationSimplified
        ? RelCollations.of(fieldCollations)
        : sortExchange.getCollation();

    call.transformTo(call.builder()
        .push(sortExchange.getInput())
        .sortExchange(distribution, collation)
        .build());
    call.getPlanner().prune(sortExchange);
  }
}
 
Example #28
Source File: RelMetadataTest.java    From calcite with Apache License 2.0 4 votes vote down vote up
@Test void testDistributionSimple() {
  RelNode rel = convertSql("select * from emp where deptno = 10");
  final RelMetadataQuery mq = rel.getCluster().getMetadataQuery();
  RelDistribution d = mq.getDistribution(rel);
  assertThat(d, is(RelDistributions.BROADCAST_DISTRIBUTED));
}
 
Example #29
Source File: RelMdDistribution.java    From calcite with Apache License 2.0 4 votes vote down vote up
/** Helper method to determine a
 * {@link Values}'s distribution. */
public static RelDistribution values(RelDataType rowType,
    ImmutableList<ImmutableList<RexLiteral>> tuples) {
  return RelDistributions.BROADCAST_DISTRIBUTED;
}
 
Example #30
Source File: TestSQLAnalyzer.java    From dremio-oss with Apache License 2.0 4 votes vote down vote up
@Override
public RelDistribution getDistribution() {
  return RelDistributions.ANY;
}