Search in sources :

Example 16 with RelTraitDef

use of org.apache.beam.vendor.calcite.v1_28_0.org.apache.calcite.plan.RelTraitDef in project beam by apache.

the class ZetaSQLPushDownTest method initializeCalciteEnvironmentWithContext.

private static void initializeCalciteEnvironmentWithContext(Context... extraContext) {
    JdbcConnection jdbcConnection = JdbcDriver.connect(tableProvider, PipelineOptionsFactory.create());
    SchemaPlus defaultSchemaPlus = jdbcConnection.getCurrentSchemaPlus();
    final ImmutableList<RelTraitDef> traitDefs = ImmutableList.of(ConventionTraitDef.INSTANCE);
    Object[] contexts = ImmutableList.<Context>builder().add(Contexts.of(jdbcConnection.config())).add(extraContext).build().toArray();
    config = Frameworks.newConfigBuilder().defaultSchema(defaultSchemaPlus).traitDefs(traitDefs).context(Contexts.of(contexts)).ruleSets(ZetaSQLQueryPlanner.getZetaSqlRuleSets().toArray(new RuleSet[0])).costFactory(BeamCostModel.FACTORY).typeSystem(jdbcConnection.getTypeFactory().getTypeSystem()).build();
}
Also used : Context(org.apache.beam.vendor.calcite.v1_28_0.org.apache.calcite.plan.Context) RuleSet(org.apache.beam.vendor.calcite.v1_28_0.org.apache.calcite.tools.RuleSet) RelTraitDef(org.apache.beam.vendor.calcite.v1_28_0.org.apache.calcite.plan.RelTraitDef) SchemaPlus(org.apache.beam.vendor.calcite.v1_28_0.org.apache.calcite.schema.SchemaPlus) JdbcConnection(org.apache.beam.sdk.extensions.sql.impl.JdbcConnection)

Aggregations

RelTraitDef (org.apache.calcite.plan.RelTraitDef)13 SchemaPlus (org.apache.calcite.schema.SchemaPlus)6 ArrayList (java.util.ArrayList)5 RelTrait (org.apache.calcite.plan.RelTrait)5 RelNode (org.apache.calcite.rel.RelNode)5 Test (org.junit.Test)4 RelTraitDef (org.apache.beam.vendor.calcite.v1_28_0.org.apache.calcite.plan.RelTraitDef)3 SchemaPlus (org.apache.beam.vendor.calcite.v1_28_0.org.apache.calcite.schema.SchemaPlus)3 RuleSet (org.apache.beam.vendor.calcite.v1_28_0.org.apache.calcite.tools.RuleSet)3 RelOptPlanner (org.apache.calcite.plan.RelOptPlanner)3 RelTraitSet (org.apache.calcite.plan.RelTraitSet)3 SqlNode (org.apache.calcite.sql.SqlNode)3 Connection (java.sql.Connection)2 CalciteConnectionConfig (org.apache.beam.vendor.calcite.v1_28_0.org.apache.calcite.config.CalciteConnectionConfig)2 CalciteCatalogReader (org.apache.beam.vendor.calcite.v1_28_0.org.apache.calcite.prepare.CalciteCatalogReader)2 SqlOperatorTable (org.apache.beam.vendor.calcite.v1_28_0.org.apache.calcite.sql.SqlOperatorTable)2 SqlParser (org.apache.beam.vendor.calcite.v1_28_0.org.apache.calcite.sql.parser.SqlParser)2 SqlParserImplFactory (org.apache.beam.vendor.calcite.v1_28_0.org.apache.calcite.sql.parser.SqlParserImplFactory)2 JavaTypeFactory (org.apache.calcite.adapter.java.JavaTypeFactory)2 CalciteConnection (org.apache.calcite.jdbc.CalciteConnection)2