Java Code Examples for org.apache.calcite.tools.RelBuilder#Config

The following examples show how to use org.apache.calcite.tools.RelBuilder#Config . 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: PigRelBuilderTest.java    From calcite with Apache License 2.0 5 votes vote down vote up
static PigRelBuilder createBuilder(
    UnaryOperator<RelBuilder.Config> transform) {
  final Frameworks.ConfigBuilder configBuilder = config();
  configBuilder.context(
      Contexts.of(transform.apply(RelBuilder.Config.DEFAULT)));
  return PigRelBuilder.create(configBuilder.build());
}
 
Example 2
Source File: RelBuilderTest.java    From calcite with Apache License 2.0 5 votes vote down vote up
/** Creates a RelBuilder with transformed config. */
static RelBuilder createBuilder(UnaryOperator<RelBuilder.Config> transform) {
  final Frameworks.ConfigBuilder configBuilder = config();
  configBuilder.context(
      Contexts.of(transform.apply(RelBuilder.Config.DEFAULT)));
  return RelBuilder.create(configBuilder.build());
}
 
Example 3
Source File: RelBuilderTest.java    From calcite with Apache License 2.0 5 votes vote down vote up
private void checkSimplify(UnaryOperator<RelBuilder.Config> transform,
    Matcher<RelNode> matcher) {
  final RelBuilder builder = createBuilder(transform);
  final RelNode root =
      builder.scan("EMP")
          .project(builder.isNotNull(builder.field("EMPNO")))
          .build();
  assertThat(root, matcher);
}
 
Example 4
Source File: RelBuilderTest.java    From calcite with Apache License 2.0 5 votes vote down vote up
private RelNode buildRelWithDuplicateAggregates(
    UnaryOperator<RelBuilder.Config> transform,
    int... groupFieldOrdinals) {
  final RelBuilder builder = createBuilder(transform);
  return builder.scan("EMP")
      .aggregate(builder.groupKey(groupFieldOrdinals),
          builder.sum(builder.field(1)).as("S1"),
          builder.count().as("C"),
          builder.sum(builder.field(2)).as("S2"),
          builder.sum(builder.field(1)).as("S1b"))
      .build();
}