Java Code Examples for org.apache.calcite.tools.FrameworkConfig#getTraitDefs()

The following examples show how to use org.apache.calcite.tools.FrameworkConfig#getTraitDefs() . 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: PlannerContext.java    From flink with Apache License 2.0 6 votes vote down vote up
public PlannerContext(
		TableConfig tableConfig,
		FunctionCatalog functionCatalog,
		CalciteSchema rootSchema,
		List<RelTraitDef> traitDefs) {
	this.tableConfig = tableConfig;
	this.functionCatalog = functionCatalog;
	this.context = new FlinkContextImpl(tableConfig, functionCatalog);
	this.rootSchema = rootSchema;
	this.traitDefs = traitDefs;
	// Make a framework config to initialize the RelOptCluster instance,
	// caution that we can only use the attributes that can not be overwrite/configured
	// by user.
	final FrameworkConfig frameworkConfig = createFrameworkConfig();

	RelOptPlanner planner = new VolcanoPlanner(frameworkConfig.getCostFactory(), frameworkConfig.getContext());
	planner.setExecutor(frameworkConfig.getExecutor());
	for (RelTraitDef traitDef : frameworkConfig.getTraitDefs()) {
		planner.addRelTraitDef(traitDef);
	}
	this.cluster = FlinkRelOptClusterFactory.create(planner, new RexBuilder(typeFactory));
}
 
Example 2
Source File: PlannerImpl.java    From calcite with Apache License 2.0 6 votes vote down vote up
/** Creates a planner. Not a public API; call
 * {@link org.apache.calcite.tools.Frameworks#getPlanner} instead. */
public PlannerImpl(FrameworkConfig config) {
  this.costFactory = config.getCostFactory();
  this.defaultSchema = config.getDefaultSchema();
  this.operatorTable = config.getOperatorTable();
  this.programs = config.getPrograms();
  this.parserConfig = config.getParserConfig();
  this.sqlValidatorConfig = config.getSqlValidatorConfig();
  this.sqlToRelConverterConfig = config.getSqlToRelConverterConfig();
  this.state = State.STATE_0_CLOSED;
  this.traitDefs = config.getTraitDefs();
  this.convertletTable = config.getConvertletTable();
  this.executor = config.getExecutor();
  this.context = config.getContext();
  this.connectionConfig = connConfig();
  reset();
}