Search in sources :

Example 6 with Context

use of org.apache.calcite.plan.Context 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

Context (org.apache.calcite.plan.Context)5 Properties (java.util.Properties)3 CalciteConnectionConfigImpl (org.apache.calcite.config.CalciteConnectionConfigImpl)3 HepProgram (org.apache.calcite.plan.hep.HepProgram)2 HepProgramBuilder (org.apache.calcite.plan.hep.HepProgramBuilder)2 Test (org.junit.Test)2 JdbcConnection (org.apache.beam.sdk.extensions.sql.impl.JdbcConnection)1 Context (org.apache.beam.vendor.calcite.v1_28_0.org.apache.calcite.plan.Context)1 RelTraitDef (org.apache.beam.vendor.calcite.v1_28_0.org.apache.calcite.plan.RelTraitDef)1 SchemaPlus (org.apache.beam.vendor.calcite.v1_28_0.org.apache.calcite.schema.SchemaPlus)1 RuleSet (org.apache.beam.vendor.calcite.v1_28_0.org.apache.calcite.tools.RuleSet)1 CalciteConnectionConfig (org.apache.calcite.config.CalciteConnectionConfig)1 RelOptCluster (org.apache.calcite.plan.RelOptCluster)1 SchemaPlus (org.apache.calcite.schema.SchemaPlus)1 FlinkContext (org.apache.flink.table.planner.calcite.FlinkContext)1 FlinkRelBuilder (org.apache.flink.table.planner.calcite.FlinkRelBuilder)1 FlinkCalciteCatalogReader (org.apache.flink.table.planner.plan.FlinkCalciteCatalogReader)1 HivePlannerContext (org.apache.hadoop.hive.ql.optimizer.calcite.HivePlannerContext)1 StatsSource (org.apache.hadoop.hive.ql.plan.mapper.StatsSource)1 OperatorStats (org.apache.hadoop.hive.ql.stats.OperatorStats)1