/** * Creates an AbstractRelOptPlanner. */ protected AbstractRelOptPlanner(RelOptCostFactory costFactory, Context context) { assert costFactory != null; this.costFactory = costFactory; if (context == null) { context = Contexts.empty(); } this.context = context; final CancelFlag cancelFlag = context.unwrap(CancelFlag.class); this.cancelFlag = cancelFlag != null ? cancelFlag.atomicBoolean : new AtomicBoolean(); // Add abstract RelNode classes. No RelNodes will ever be registered with // these types, but some operands may use them. classes.add(RelNode.class); classes.add(RelSubset.class); }
private static Context chain(Iterable<? extends Context> contexts) { // Flatten any chain contexts in the list, and remove duplicates final List<Context> list = new ArrayList<>(); for (Context context : contexts) { build(list, context); } switch (list.size()) { case 0: return empty(); case 1: return list.get(0); default: return new ChainContext(ImmutableList.copyOf(list)); } }
/** * Creates an AbstractRelOptPlanner. */ protected AbstractRelOptPlanner(RelOptCostFactory costFactory, Context context) { assert costFactory != null; this.costFactory = costFactory; if (context == null) { context = Contexts.empty(); } this.context = context; final CancelFlag cancelFlag = context.unwrap(CancelFlag.class); this.cancelFlag = cancelFlag != null ? cancelFlag.atomicBoolean : new AtomicBoolean(); // Add abstract RelNode classes. No RelNodes will ever be registered with // these types, but some operands may use them. classes.add(RelNode.class); classes.add(RelSubset.class); }
private static Context chain(Iterable<? extends Context> contexts) { // Flatten any chain contexts in the list, and remove duplicates final List<Context> list = new ArrayList<>(); for (Context context : contexts) { build(list, context); } switch (list.size()) { case 0: return empty(); case 1: return list.get(0); default: return new ChainContext(ImmutableList.copyOf(list)); } }
/** * Creates a TesterImpl. * * @param diffRepos Diff repository * @param enableDecorrelate Whether to decorrelate * @param enableTrim Whether to trim unused fields * @param enableExpand Whether to expand sub-queries * @param catalogReaderFactory Function to create catalog reader, or null * @param clusterFactory Called after a cluster has been created */ protected TesterImpl(DiffRepository diffRepos, boolean enableDecorrelate, boolean enableTrim, boolean enableExpand, boolean enableLateDecorrelate, SqlTestFactory.MockCatalogReaderFactory catalogReaderFactory, Function<RelOptCluster, RelOptCluster> clusterFactory) { this(diffRepos, enableDecorrelate, enableTrim, enableExpand, enableLateDecorrelate, catalogReaderFactory, clusterFactory, SqlToRelConverter.Config.DEFAULT, SqlConformanceEnum.DEFAULT, Contexts.empty()); }
/** * Creates a TesterImpl. * * @param diffRepos Diff repository * @param enableDecorrelate Whether to decorrelate * @param enableTrim Whether to trim unused fields * @param enableExpand Whether to expand sub-queries * @param catalogReaderFactory Function to create catalog reader, or null * @param clusterFactory Called after a cluster has been created */ protected TesterImpl(DiffRepository diffRepos, boolean enableDecorrelate, boolean enableTrim, boolean enableExpand, boolean enableLateDecorrelate, SqlTestFactory.MockCatalogReaderFactory catalogReaderFactory, Function<RelOptCluster, RelOptCluster> clusterFactory) { this(diffRepos, enableDecorrelate, enableTrim, enableExpand, enableLateDecorrelate, catalogReaderFactory, clusterFactory, SqlToRelConverter.Config.DEFAULT, SqlConformanceEnum.DEFAULT, Contexts.empty()); }
protected Tester createTester() { return new TesterImpl(getDiffRepos(), false, false, true, false, null, null, SqlToRelConverter.Config.DEFAULT, SqlConformanceEnum.DEFAULT, Contexts.empty()); }
protected Tester createTester() { return new TesterImpl(getDiffRepos(), false, false, true, false, null, null, SqlToRelConverter.Config.DEFAULT, SqlConformanceEnum.DEFAULT, Contexts.empty()); }
protected Tester createTester(SqlConformance conformance) { return new TesterImpl(getDiffRepos(), false, false, true, false, null, null, SqlToRelConverter.Config.DEFAULT, conformance, Contexts.empty()); }
protected Tester createTester(SqlConformance conformance) { return new TesterImpl(getDiffRepos(), false, false, true, false, null, null, SqlToRelConverter.Config.DEFAULT, conformance, Contexts.empty()); }
public static BlinkRelBuilder create(FrameworkConfig config) { JavaTypeFactory typeFactory = new JavaTypeFactoryImpl(config.getTypeSystem()); VolcanoPlanner planner = new VolcanoPlanner(config.getCostFactory(), Contexts.empty()); planner.setExecutor(config.getExecutor()); planner.addRelTraitDef(ConventionTraitDef.INSTANCE); RelOptCluster cluster = RelOptCluster.create(planner, new RexBuilder(typeFactory)); CalciteSchema calciteSchema = CalciteSchema.from(config.getDefaultSchema()); Properties prop = new Properties(); prop.setProperty(CalciteConnectionProperty.CASE_SENSITIVE.camelName(), String.valueOf(config.getParserConfig().caseSensitive())); CalciteConnectionConfig connectionConfig = new CalciteConnectionConfigImpl(prop); RelOptSchema relOptSchema = new CalciteCatalogReader( calciteSchema, CalciteSchema.from(config.getDefaultSchema()).path(null), typeFactory, connectionConfig); return new BlinkRelBuilder(config.getContext(), cluster, relOptSchema); } }