本文整理汇总了Java中org.apache.calcite.rel.rules.ProjectSetOpTransposeRule类的典型用法代码示例。如果您正苦于以下问题:Java ProjectSetOpTransposeRule类的具体用法?Java ProjectSetOpTransposeRule怎么用?Java ProjectSetOpTransposeRule使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ProjectSetOpTransposeRule类属于org.apache.calcite.rel.rules包,在下文中一共展示了ProjectSetOpTransposeRule类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testUnionMergeRule
import org.apache.calcite.rel.rules.ProjectSetOpTransposeRule; //导入依赖的package包/类
/** Tests to see if the final branch of union is missed */
@Test
public void testUnionMergeRule() throws Exception {
HepProgram program = new HepProgramBuilder()
.addRuleInstance(ProjectSetOpTransposeRule.INSTANCE)
.addRuleInstance(ProjectRemoveRule.INSTANCE)
.addRuleInstance(UnionMergeRule.INSTANCE)
.build();
checkPlanning(program,
"select * from (\n"
+ "select * from (\n"
+ " select name, deptno from dept\n"
+ " union all\n"
+ " select name, deptno from\n"
+ " (\n"
+ " select name, deptno, count(1) from dept group by name, deptno\n"
+ " union all\n"
+ " select name, deptno, count(1) from dept group by name, deptno\n"
+ " ) subq\n"
+ ") a\n"
+ "union all\n"
+ "select name, deptno from dept\n"
+ ") aa\n");
}
示例2: testSortUnionTranspose
import org.apache.calcite.rel.rules.ProjectSetOpTransposeRule; //导入依赖的package包/类
/** Test case for
* <a href="https://issues.apache.org/jira/browse/CALCITE-889">[CALCITE-889]
* Implement SortUnionTransposeRule</a>. */
@Test public void testSortUnionTranspose() {
final HepProgram program =
HepProgram.builder()
.addRuleInstance(ProjectSetOpTransposeRule.INSTANCE)
.addRuleInstance(SortUnionTransposeRule.INSTANCE)
.build();
final String sql = "select a.name from dept a\n"
+ "union all\n"
+ "select b.name from dept b\n"
+ "order by name limit 10";
checkPlanning(program, sql);
}
示例3: testSortUnionTranspose2
import org.apache.calcite.rel.rules.ProjectSetOpTransposeRule; //导入依赖的package包/类
/** Test case for
* <a href="https://issues.apache.org/jira/browse/CALCITE-889">[CALCITE-889]
* Implement SortUnionTransposeRule</a>. */
@Test public void testSortUnionTranspose2() {
final HepProgram program =
HepProgram.builder()
.addRuleInstance(ProjectSetOpTransposeRule.INSTANCE)
.addRuleInstance(SortUnionTransposeRule.MATCH_NULL_FETCH)
.build();
final String sql = "select a.name from dept a\n"
+ "union all\n"
+ "select b.name from dept b\n"
+ "order by name";
checkPlanning(program, sql);
}
示例4: testSortUnionTranspose3
import org.apache.calcite.rel.rules.ProjectSetOpTransposeRule; //导入依赖的package包/类
/** Test case for
* <a href="https://issues.apache.org/jira/browse/CALCITE-987">[CALCITE-987]
* Push limit 0 will result in an infinite loop</a>. */
@Test public void testSortUnionTranspose3() {
final HepProgram program =
HepProgram.builder()
.addRuleInstance(ProjectSetOpTransposeRule.INSTANCE)
.addRuleInstance(SortUnionTransposeRule.MATCH_NULL_FETCH)
.build();
final String sql = "select a.name from dept a\n"
+ "union all\n"
+ "select b.name from dept b\n"
+ "order by name limit 0";
checkPlanning(program, sql);
}
示例5: testMinusMergeRule
import org.apache.calcite.rel.rules.ProjectSetOpTransposeRule; //导入依赖的package包/类
@Test
public void testMinusMergeRule() throws Exception {
HepProgram program = new HepProgramBuilder()
.addRuleInstance(ProjectSetOpTransposeRule.INSTANCE)
.addRuleInstance(ProjectRemoveRule.INSTANCE)
.addRuleInstance(UnionMergeRule.MINUS_INSTANCE)
.build();
checkPlanning(program,
"select * from (\n"
+ "select * from (\n"
+ " select name, deptno from\n"
+ " (\n"
+ " select name, deptno, count(1) from dept group by name, deptno\n"
+ " except all\n"
+ " select name, deptno, 1 from dept\n"
+ " ) subq\n"
+ " except all\n"
+ " select name, deptno from\n"
+ " (\n"
+ " select name, deptno, 1 from dept\n"
+ " except all\n"
+ " select name, deptno, count(1) from dept group by name, deptno\n"
+ " ) subq2\n"
+ ") a\n"
+ "except all\n"
+ "select name, deptno from dept\n"
+ ") aa\n");
}
示例6: basePushAggThroughUnion
import org.apache.calcite.rel.rules.ProjectSetOpTransposeRule; //导入依赖的package包/类
private void basePushAggThroughUnion() throws Exception {
HepProgram program = new HepProgramBuilder()
.addRuleInstance(ProjectSetOpTransposeRule.INSTANCE)
.addRuleInstance(ProjectMergeRule.INSTANCE)
.addRuleInstance(AggregateUnionTransposeRule.INSTANCE)
.build();
checkPlanning(program, "${sql}");
}
示例7: testPushProjectPastSetOp
import org.apache.calcite.rel.rules.ProjectSetOpTransposeRule; //导入依赖的package包/类
@Test public void testPushProjectPastSetOp() {
checkPlanning(ProjectSetOpTransposeRule.INSTANCE,
"select sal from "
+ "(select * from emp e1 union all select * from emp e2)");
}