当前位置: 首页>>代码示例>>Java>>正文


Java HepProgramBuilder.addMatchOrder方法代码示例

本文整理汇总了Java中org.apache.calcite.plan.hep.HepProgramBuilder.addMatchOrder方法的典型用法代码示例。如果您正苦于以下问题:Java HepProgramBuilder.addMatchOrder方法的具体用法?Java HepProgramBuilder.addMatchOrder怎么用?Java HepProgramBuilder.addMatchOrder使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.calcite.plan.hep.HepProgramBuilder的用法示例。


在下文中一共展示了HepProgramBuilder.addMatchOrder方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: testSubprogram

import org.apache.calcite.plan.hep.HepProgramBuilder; //导入方法依赖的package包/类
@Test public void testSubprogram() throws Exception {
  // Verify that subprogram gets re-executed until fixpoint.
  // In this case, the first time through we limit it to generate
  // only one calc; the second time through it will generate
  // a second calc, and then merge them.
  HepProgramBuilder subprogramBuilder = HepProgram.builder();
  subprogramBuilder.addMatchOrder(HepMatchOrder.TOP_DOWN);
  subprogramBuilder.addMatchLimit(1);
  subprogramBuilder.addRuleInstance(ProjectToCalcRule.INSTANCE);
  subprogramBuilder.addRuleInstance(CalcMergeRule.INSTANCE);

  HepProgramBuilder programBuilder = HepProgram.builder();
  programBuilder.addSubprogram(subprogramBuilder.build());

  checkPlanning(
      programBuilder.build(),
      "select upper(ename) from (select lower(ename) as ename from emp)");
}
 
开发者ID:apache,项目名称:calcite,代码行数:19,代码来源:HepPlannerTest.java

示例2: testGC

import org.apache.calcite.plan.hep.HepProgramBuilder; //导入方法依赖的package包/类
@Test public void testGC() throws Exception {
  HepProgramBuilder programBuilder = HepProgram.builder();
  programBuilder.addMatchOrder(HepMatchOrder.TOP_DOWN);
  programBuilder.addRuleInstance(CalcMergeRule.INSTANCE);
  programBuilder.addRuleInstance(ProjectToCalcRule.INSTANCE);
  programBuilder.addRuleInstance(FilterToCalcRule.INSTANCE);

  HepPlanner planner = new HepPlanner(programBuilder.build());
  planner.setRoot(
      tester.convertSqlToRel("select upper(name) from dept where deptno=20").rel);
  planner.findBestExp();
  // Reuse of HepPlanner (should trigger GC).
  planner.setRoot(
      tester.convertSqlToRel("select upper(name) from dept where deptno=20").rel);
  planner.findBestExp();
}
 
开发者ID:apache,项目名称:calcite,代码行数:17,代码来源:HepPlannerTest.java

示例3: testMatchLimitOneTopDown

import org.apache.calcite.plan.hep.HepProgramBuilder; //导入方法依赖的package包/类
@Test public void testMatchLimitOneTopDown() throws Exception {
  // Verify that only the top union gets rewritten.

  HepProgramBuilder programBuilder = HepProgram.builder();
  programBuilder.addMatchOrder(HepMatchOrder.TOP_DOWN);
  programBuilder.addMatchLimit(1);
  programBuilder.addRuleInstance(UnionToDistinctRule.INSTANCE);

  checkPlanning(
      programBuilder.build(), UNION_TREE);
}
 
开发者ID:apache,项目名称:calcite,代码行数:12,代码来源:HepPlannerTest.java

示例4: testMatchLimitOneBottomUp

import org.apache.calcite.plan.hep.HepProgramBuilder; //导入方法依赖的package包/类
@Test public void testMatchLimitOneBottomUp() throws Exception {
  // Verify that only the bottom union gets rewritten.

  HepProgramBuilder programBuilder = HepProgram.builder();
  programBuilder.addMatchLimit(1);
  programBuilder.addMatchOrder(HepMatchOrder.BOTTOM_UP);
  programBuilder.addRuleInstance(UnionToDistinctRule.INSTANCE);

  checkPlanning(
      programBuilder.build(), UNION_TREE);
}
 
开发者ID:apache,项目名称:calcite,代码行数:12,代码来源:HepPlannerTest.java

示例5: checkRuleApplyCount

import org.apache.calcite.plan.hep.HepProgramBuilder; //导入方法依赖的package包/类
private long checkRuleApplyCount(HepMatchOrder matchOrder) {
  final HepProgramBuilder programBuilder = HepProgram.builder();
  programBuilder.addMatchOrder(matchOrder);
  programBuilder.addRuleInstance(ReduceExpressionsRule.FILTER_INSTANCE);
  programBuilder.addRuleInstance(ReduceExpressionsRule.PROJECT_INSTANCE);

  final HepTestListener listener = new HepTestListener(0);
  HepPlanner planner = new HepPlanner(programBuilder.build());
  planner.addListener(listener);
  planner.setRoot(tester.convertSqlToRel(COMPLEX_UNION_TREE).rel);
  planner.findBestExp();
  return listener.getApplyTimes();
}
 
开发者ID:apache,项目名称:calcite,代码行数:14,代码来源:HepPlannerTest.java


注:本文中的org.apache.calcite.plan.hep.HepProgramBuilder.addMatchOrder方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。