org.apache.calcite.tools.Frameworks.newConfigBuilder()方法的使用及代码示例

x33g5p2x  于2022-01-19 转载在 其他  
字(8.6k)|赞(0)|评价(0)|浏览(133)

本文整理了Java中org.apache.calcite.tools.Frameworks.newConfigBuilder()方法的一些代码示例,展示了Frameworks.newConfigBuilder()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Frameworks.newConfigBuilder()方法的具体详情如下:
包路径:org.apache.calcite.tools.Frameworks
类名称:Frameworks
方法名:newConfigBuilder

Frameworks.newConfigBuilder介绍

[英]Creates a config builder with each setting initialized to its default value.
[中]创建配置生成器,并将每个设置初始化为其默认值。

代码示例

代码示例来源:origin: apache/storm

public FrameworkConfig buildFrameWorkConfig() {
  if (hasUdf) {
    List<SqlOperatorTable> sqlOperatorTables = new ArrayList<>();
    sqlOperatorTables.add(SqlStdOperatorTable.instance());
    sqlOperatorTables.add(new CalciteCatalogReader(CalciteSchema.from(schema),
        Collections.emptyList(), typeFactory, new CalciteConnectionConfigImpl(new Properties())));
    return Frameworks.newConfigBuilder().defaultSchema(schema)
             .operatorTable(new ChainedSqlOperatorTable(sqlOperatorTables)).build();
  } else {
    return Frameworks.newConfigBuilder().defaultSchema(schema).build();
  }
}

代码示例来源:origin: apache/storm

public QueryPlanner(SchemaPlus schema) {
  final List<RelTraitDef> traitDefs = new ArrayList<RelTraitDef>();
  traitDefs.add(ConventionTraitDef.INSTANCE);
  traitDefs.add(RelCollationTraitDef.INSTANCE);
  List<SqlOperatorTable> sqlOperatorTables = new ArrayList<>();
  sqlOperatorTables.add(SqlStdOperatorTable.instance());
  sqlOperatorTables.add(new CalciteCatalogReader(CalciteSchema.from(schema),
      Collections.emptyList(), typeFactory, new CalciteConnectionConfigImpl(new Properties())));
  FrameworkConfig config = Frameworks.newConfigBuilder()
                    .defaultSchema(schema)
                    .operatorTable(new ChainedSqlOperatorTable(sqlOperatorTables))
                    .traitDefs(traitDefs)
                    .context(Contexts.EMPTY_CONTEXT)
                    .ruleSets(StreamsStormRuleSets.getRuleSets())
                    .costFactory(null)
                    .typeSystem(StormRelDataTypeSystem.STORM_REL_DATATYPE_SYSTEM)
                    .build();
  this.planner = Frameworks.getPlanner(config);
}

代码示例来源:origin: apache/drill

/**
 * Get optimized logical plan for the given QB tree in the semAnalyzer.
 *
 * @return
 * @throws SemanticException
 */
RelNode logicalPlan() throws SemanticException {
 RelNode optimizedOptiqPlan = null;
 CalcitePlannerAction calcitePlannerAction = null;
 if (this.columnAccessInfo == null) {
  this.columnAccessInfo = new ColumnAccessInfo();
 }
 calcitePlannerAction = new CalcitePlannerAction(prunedPartitions, this.columnAccessInfo);
 try {
  optimizedOptiqPlan = Frameworks.withPlanner(calcitePlannerAction, Frameworks
    .newConfigBuilder().typeSystem(new HiveTypeSystemImpl()).build());
 } catch (Exception e) {
  rethrowCalciteException(e);
  throw new AssertionError("rethrowCalciteException didn't throw for " + e.getMessage());
 }
 return optimizedOptiqPlan;
}

代码示例来源:origin: apache/hive

/**
 * Get optimized logical plan for the given QB tree in the semAnalyzer.
 *
 * @return
 * @throws SemanticException
 */
RelNode logicalPlan() throws SemanticException {
 RelNode optimizedOptiqPlan = null;
 CalcitePlannerAction calcitePlannerAction = null;
 if (this.columnAccessInfo == null) {
  this.columnAccessInfo = new ColumnAccessInfo();
 }
 calcitePlannerAction = new CalcitePlannerAction(
   prunedPartitions,
   ctx.getOpContext().getColStatsCache(),
   this.columnAccessInfo);
 try {
  optimizedOptiqPlan = Frameworks.withPlanner(calcitePlannerAction, Frameworks
    .newConfigBuilder().typeSystem(new HiveTypeSystemImpl()).build());
 } catch (Exception e) {
  rethrowCalciteException(e);
  throw new AssertionError("rethrowCalciteException didn't throw for " + e.getMessage());
 }
 return optimizedOptiqPlan;
}

代码示例来源:origin: apache/hive

.newConfigBuilder().typeSystem(new HiveTypeSystemImpl()).build());
} catch (Exception e) {
 rethrowCalciteException(e);

代码示例来源:origin: apache/drill

.newConfigBuilder().typeSystem(new HiveTypeSystemImpl()).build());
} catch (Exception e) {
 rethrowCalciteException(e);

代码示例来源:origin: apache/incubator-druid

.build();
final FrameworkConfig frameworkConfig = Frameworks
  .newConfigBuilder()
  .parserConfig(PARSER_CONFIG)
  .traitDefs(ConventionTraitDef.INSTANCE, RelCollationTraitDef.INSTANCE)

代码示例来源:origin: org.apache.calcite/calcite-core

public PrepareAction() {
 this.config = newConfigBuilder() //
   .defaultSchema(Frameworks.createRootSchema(true)).build();
}

代码示例来源:origin: Qihoo360/Quicksql

/**
 * Initializes a container then calls user-specified code with a planner.
 *
 * @param action Callback containing user-specified code
 * @return Return value from action
 */
public static <R> R withPlanner(final PlannerAction<R> action) {
 FrameworkConfig config = newConfigBuilder() //
   .defaultSchema(Frameworks.createRootSchema(true)).build();
 return withPlanner(action, config);
}

代码示例来源:origin: org.apache.calcite/calcite-core

/**
 * Initializes a container then calls user-specified code with a planner.
 *
 * @param action Callback containing user-specified code
 * @return Return value from action
 */
public static <R> R withPlanner(final PlannerAction<R> action) {
 FrameworkConfig config = newConfigBuilder() //
   .defaultSchema(Frameworks.createRootSchema(true)).build();
 return withPlanner(action, config);
}

代码示例来源:origin: org.apache.calcite/calcite-core

Tester() {
 this(
   Frameworks.newConfigBuilder()
     .defaultSchema(schemaFrom(CalciteAssert.SchemaSpec.SCOTT))
     .build());
}

代码示例来源:origin: Qihoo360/Quicksql

/** Creates a config based on the "scott" schema. */
private static Frameworks.ConfigBuilder config() {
 final SchemaPlus rootSchema = Frameworks.createRootSchema(true);
 return Frameworks.newConfigBuilder()
   .parserConfig(SqlParser.Config.DEFAULT)
   .defaultSchema(CalciteAssert.addSchema(rootSchema, CalciteAssert.SchemaSpec.SCOTT));
}

代码示例来源:origin: org.apache.calcite/calcite-core

/** Creates a config based on the "scott" schema. */
private static Frameworks.ConfigBuilder config() {
 final SchemaPlus rootSchema = Frameworks.createRootSchema(true);
 return Frameworks.newConfigBuilder()
   .parserConfig(SqlParser.Config.DEFAULT)
   .defaultSchema(CalciteAssert.addSchema(rootSchema, CalciteAssert.SchemaSpec.SCOTT));
}

代码示例来源:origin: Qihoo360/Quicksql

/** Creates a config based on the "scott" schema. */
public static Frameworks.ConfigBuilder config() {
 final SchemaPlus rootSchema = Frameworks.createRootSchema(true);
 return Frameworks.newConfigBuilder()
   .parserConfig(SqlParser.Config.DEFAULT)
   .defaultSchema(
     CalciteAssert.addSchema(rootSchema, CalciteAssert.SchemaSpec.SCOTT))
   .traitDefs((List<RelTraitDef>) null)
   .programs(Programs.heuristicJoinOrder(Programs.RULE_SET, true, 2));
}

代码示例来源:origin: org.apache.calcite/calcite-core

/** Creates a config based on the "scott" schema. */
public static Frameworks.ConfigBuilder config() {
 final SchemaPlus rootSchema = Frameworks.createRootSchema(true);
 return Frameworks.newConfigBuilder()
   .parserConfig(SqlParser.Config.DEFAULT)
   .defaultSchema(
     CalciteAssert.addSchema(rootSchema, CalciteAssert.SchemaSpec.SCOTT))
   .traitDefs((List<RelTraitDef>) null)
   .programs(Programs.heuristicJoinOrder(Programs.RULE_SET, true, 2));
}

代码示例来源:origin: org.apache.calcite/calcite-core

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);
}

代码示例来源:origin: Qihoo360/Quicksql

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);
}

代码示例来源:origin: Qihoo360/Quicksql

@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);
}

代码示例来源:origin: org.apache.calcite/calcite-core

@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);
}

代码示例来源:origin: org.apache.calcite/calcite-core

private 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);
}

相关文章