use of org.apache.beam.vendor.calcite.v1_28_0.org.apache.calcite.tools.FrameworkConfig in project calcite by apache.
the class CalciteMetaImpl method toQuery.
/**
* Wraps the SQL string in a
* {@link org.apache.calcite.jdbc.CalcitePrepare.Query} object, giving the
* {@link Hook#STRING_TO_QUERY} hook chance to override.
*/
private CalcitePrepare.Query<Object> toQuery(Context context, String sql) {
final Holder<CalcitePrepare.Query<Object>> queryHolder = Holder.of(CalcitePrepare.Query.of(sql));
final FrameworkConfig config = Frameworks.newConfigBuilder().parserConfig(SqlParser.Config.DEFAULT).defaultSchema(context.getRootSchema().plus()).build();
Hook.STRING_TO_QUERY.run(Pair.of(config, queryHolder));
return queryHolder.get();
}
use of org.apache.beam.vendor.calcite.v1_28_0.org.apache.calcite.tools.FrameworkConfig in project calcite by apache.
the class RelMetadataTest method testGetPredicatesForJoin.
@Test
public void testGetPredicatesForJoin() throws Exception {
final FrameworkConfig config = RelBuilderTest.config().build();
final RelBuilder builder = RelBuilder.create(config);
RelNode join = builder.scan("EMP").scan("DEPT").join(JoinRelType.INNER, builder.call(NONDETERMINISTIC_OP)).build();
RelMetadataQuery mq = RelMetadataQuery.instance();
assertTrue(mq.getPulledUpPredicates(join).pulledUpPredicates.isEmpty());
RelNode join1 = builder.scan("EMP").scan("DEPT").join(JoinRelType.INNER, builder.call(SqlStdOperatorTable.EQUALS, builder.field(2, 0, 0), builder.field(2, 1, 0))).build();
assertEquals("=($0, $8)", mq.getPulledUpPredicates(join1).pulledUpPredicates.get(0).toString());
}
use of org.apache.beam.vendor.calcite.v1_28_0.org.apache.calcite.tools.FrameworkConfig in project calcite by apache.
the class RelMetadataTest method testGetPredicatesForFilter.
@Test
public void testGetPredicatesForFilter() throws Exception {
final FrameworkConfig config = RelBuilderTest.config().build();
final RelBuilder builder = RelBuilder.create(config);
RelNode filter = builder.scan("EMP").filter(builder.call(NONDETERMINISTIC_OP)).build();
RelMetadataQuery mq = RelMetadataQuery.instance();
assertTrue(mq.getPulledUpPredicates(filter).pulledUpPredicates.isEmpty());
RelNode filter1 = builder.scan("EMP").filter(builder.call(SqlStdOperatorTable.EQUALS, builder.field(1, 0, 0), builder.field(1, 0, 1))).build();
assertEquals("=($0, $1)", mq.getPulledUpPredicates(filter1).pulledUpPredicates.get(0).toString());
}
use of org.apache.beam.vendor.calcite.v1_28_0.org.apache.calcite.tools.FrameworkConfig in project calcite by apache.
the class InterpreterTest method setUp.
@Before
public void setUp() {
rootSchema = Frameworks.createRootSchema(true);
final FrameworkConfig config = Frameworks.newConfigBuilder().parserConfig(SqlParser.Config.DEFAULT).defaultSchema(CalciteAssert.addSchema(rootSchema, CalciteAssert.SchemaSpec.HR)).build();
planner = Frameworks.getPlanner(config);
dataContext = new MyDataContext(planner);
}
use of org.apache.beam.vendor.calcite.v1_28_0.org.apache.calcite.tools.FrameworkConfig in project calcite by apache.
the class LexCaseSensitiveTest method getPlanner.
private static Planner getPlanner(List<RelTraitDef> traitDefs, SqlParser.Config parserConfig, Program... programs) {
final SchemaPlus rootSchema = Frameworks.createRootSchema(true);
final FrameworkConfig config = Frameworks.newConfigBuilder().parserConfig(parserConfig).defaultSchema(CalciteAssert.addSchema(rootSchema, CalciteAssert.SchemaSpec.HR)).traitDefs(traitDefs).programs(programs).build();
return Frameworks.getPlanner(config);
}
Aggregations