本文整理汇总了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)");
}
示例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();
}
示例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);
}
示例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);
}
示例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();
}