本文整理汇总了Java中org.apache.calcite.rel.rules.AggregateExpandDistinctAggregatesRule类的典型用法代码示例。如果您正苦于以下问题:Java AggregateExpandDistinctAggregatesRule类的具体用法?Java AggregateExpandDistinctAggregatesRule怎么用?Java AggregateExpandDistinctAggregatesRule使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
AggregateExpandDistinctAggregatesRule类属于org.apache.calcite.rel.rules包,在下文中一共展示了AggregateExpandDistinctAggregatesRule类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: register
import org.apache.calcite.rel.rules.AggregateExpandDistinctAggregatesRule; //导入依赖的package包/类
@Override public void register(RelOptPlanner planner) {
planner.addRule(PigToEnumerableConverterRule.INSTANCE);
for (RelOptRule rule : PigRules.ALL_PIG_OPT_RULES) {
planner.addRule(rule);
}
// Don't move Aggregates around, otherwise PigAggregate.implement() won't
// know how to correctly procuce Pig Latin
planner.removeRule(AggregateExpandDistinctAggregatesRule.INSTANCE);
// Make sure planner picks PigJoin over EnumerableJoin. Should there be
// a rule for this instead for removing ENUMERABLE_JOIN_RULE here?
planner.removeRule(EnumerableRules.ENUMERABLE_JOIN_RULE);
}
开发者ID:apache,项目名称:calcite,代码行数:13,代码来源:PigTableScan.java
示例2: testDistinctCountWithoutGroupBy
import org.apache.calcite.rel.rules.AggregateExpandDistinctAggregatesRule; //导入依赖的package包/类
@Test public void testDistinctCountWithoutGroupBy() {
final HepProgram program = HepProgram.builder()
.addRuleInstance(AggregateExpandDistinctAggregatesRule.INSTANCE)
.addRuleInstance(AggregateProjectMergeRule.INSTANCE)
.build();
final String sql = "select max(deptno), count(distinct ename)\n"
+ "from sales.emp";
sql(sql).with(program).check();
}
开发者ID:apache,项目名称:calcite,代码行数:10,代码来源:RelOptRulesTest.java
示例3: testDistinctCount1
import org.apache.calcite.rel.rules.AggregateExpandDistinctAggregatesRule; //导入依赖的package包/类
@Test public void testDistinctCount1() {
final HepProgram program = HepProgram.builder()
.addRuleInstance(AggregateExpandDistinctAggregatesRule.INSTANCE)
.addRuleInstance(AggregateProjectMergeRule.INSTANCE)
.build();
checkPlanning(program,
"select deptno, count(distinct ename)"
+ " from sales.emp group by deptno");
}
开发者ID:apache,项目名称:calcite,代码行数:10,代码来源:RelOptRulesTest.java
示例4: testDistinctCount2
import org.apache.calcite.rel.rules.AggregateExpandDistinctAggregatesRule; //导入依赖的package包/类
@Test public void testDistinctCount2() {
final HepProgram program = HepProgram.builder()
.addRuleInstance(AggregateExpandDistinctAggregatesRule.INSTANCE)
.addRuleInstance(AggregateProjectMergeRule.INSTANCE)
.build();
checkPlanning(program,
"select deptno, count(distinct ename), sum(sal)"
+ " from sales.emp group by deptno");
}
开发者ID:apache,项目名称:calcite,代码行数:10,代码来源:RelOptRulesTest.java
示例5: testDistinctCount3
import org.apache.calcite.rel.rules.AggregateExpandDistinctAggregatesRule; //导入依赖的package包/类
/** Test case for
* <a href="https://issues.apache.org/jira/browse/CALCITE-1293">[CALCITE-1293]
* Bad code generated when argument to COUNT(DISTINCT) is a # GROUP BY
* column</a>. */
@Test public void testDistinctCount3() {
final String sql = "select count(distinct deptno), sum(sal)"
+ " from sales.emp group by deptno";
final HepProgram program = HepProgram.builder()
.addRuleInstance(AggregateExpandDistinctAggregatesRule.INSTANCE)
.build();
sql(sql).with(program).check();
}
开发者ID:apache,项目名称:calcite,代码行数:13,代码来源:RelOptRulesTest.java
示例6: testDistinctCountMultipleViaJoin
import org.apache.calcite.rel.rules.AggregateExpandDistinctAggregatesRule; //导入依赖的package包/类
/** Tests implementing multiple distinct count the old way, using a join. */
@Test public void testDistinctCountMultipleViaJoin() {
final HepProgram program = HepProgram.builder()
.addRuleInstance(AggregateExpandDistinctAggregatesRule.JOIN)
.addRuleInstance(AggregateProjectMergeRule.INSTANCE)
.build();
checkPlanning(program,
"select deptno, count(distinct ename), count(distinct job, ename),\n"
+ " count(distinct deptno, job), sum(sal)\n"
+ " from sales.emp group by deptno");
}
开发者ID:apache,项目名称:calcite,代码行数:12,代码来源:RelOptRulesTest.java
示例7: testDistinctCountMultiple
import org.apache.calcite.rel.rules.AggregateExpandDistinctAggregatesRule; //导入依赖的package包/类
/** Tests implementing multiple distinct count the new way, using GROUPING
* SETS. */
@Test public void testDistinctCountMultiple() {
final HepProgram program = HepProgram.builder()
.addRuleInstance(AggregateExpandDistinctAggregatesRule.INSTANCE)
.addRuleInstance(AggregateProjectMergeRule.INSTANCE)
.build();
checkPlanning(program,
"select deptno, count(distinct ename), count(distinct job)\n"
+ " from sales.emp group by deptno");
}
开发者ID:apache,项目名称:calcite,代码行数:12,代码来源:RelOptRulesTest.java
示例8: testDistinctCountMultipleNoGroup
import org.apache.calcite.rel.rules.AggregateExpandDistinctAggregatesRule; //导入依赖的package包/类
@Test public void testDistinctCountMultipleNoGroup() {
final HepProgram program = HepProgram.builder()
.addRuleInstance(AggregateExpandDistinctAggregatesRule.INSTANCE)
.addRuleInstance(AggregateProjectMergeRule.INSTANCE)
.build();
checkPlanning(program,
"select count(distinct ename), count(distinct job)\n"
+ " from sales.emp");
}
开发者ID:apache,项目名称:calcite,代码行数:10,代码来源:RelOptRulesTest.java
示例9: testDistinctCountMixedJoin
import org.apache.calcite.rel.rules.AggregateExpandDistinctAggregatesRule; //导入依赖的package包/类
@Test public void testDistinctCountMixedJoin() {
final HepProgram program = HepProgram.builder()
.addRuleInstance(AggregateExpandDistinctAggregatesRule.JOIN)
.addRuleInstance(AggregateProjectMergeRule.INSTANCE)
.build();
checkPlanning(program,
"select deptno, count(distinct ename), count(distinct job, ename),\n"
+ " count(distinct deptno, job), sum(sal)\n"
+ " from sales.emp group by deptno");
}
开发者ID:apache,项目名称:calcite,代码行数:11,代码来源:RelOptRulesTest.java
示例10: testDistinctCountMixed
import org.apache.calcite.rel.rules.AggregateExpandDistinctAggregatesRule; //导入依赖的package包/类
@Test public void testDistinctCountMixed() {
final HepProgram program = HepProgram.builder()
.addRuleInstance(AggregateExpandDistinctAggregatesRule.INSTANCE)
.addRuleInstance(ProjectMergeRule.INSTANCE)
.build();
checkPlanning(program,
"select deptno, count(distinct deptno, job) as cddj, sum(sal) as s\n"
+ " from sales.emp group by deptno");
}
开发者ID:apache,项目名称:calcite,代码行数:10,代码来源:RelOptRulesTest.java
示例11: testDistinctCountMixed2
import org.apache.calcite.rel.rules.AggregateExpandDistinctAggregatesRule; //导入依赖的package包/类
@Test public void testDistinctCountMixed2() {
final HepProgram program = HepProgram.builder()
.addRuleInstance(AggregateExpandDistinctAggregatesRule.INSTANCE)
.addRuleInstance(AggregateProjectMergeRule.INSTANCE)
.addRuleInstance(ProjectMergeRule.INSTANCE)
.build();
checkPlanning(program,
"select deptno, count(distinct ename) as cde,\n"
+ " count(distinct job, ename) as cdje,\n"
+ " count(distinct deptno, job) as cddj,\n"
+ " sum(sal) as s\n"
+ " from sales.emp group by deptno");
}
开发者ID:apache,项目名称:calcite,代码行数:14,代码来源:RelOptRulesTest.java
示例12: testDistinctCountGroupingSets1
import org.apache.calcite.rel.rules.AggregateExpandDistinctAggregatesRule; //导入依赖的package包/类
@Test public void testDistinctCountGroupingSets1() {
final HepProgram program = HepProgram.builder()
.addRuleInstance(AggregateExpandDistinctAggregatesRule.INSTANCE)
.addRuleInstance(ProjectMergeRule.INSTANCE)
.build();
checkPlanning(program,
"select deptno, job, count(distinct ename)"
+ " from sales.emp group by rollup(deptno,job)");
}
开发者ID:apache,项目名称:calcite,代码行数:10,代码来源:RelOptRulesTest.java
示例13: testDistinctCountGroupingSets2
import org.apache.calcite.rel.rules.AggregateExpandDistinctAggregatesRule; //导入依赖的package包/类
@Test public void testDistinctCountGroupingSets2() {
final HepProgram program = HepProgram.builder()
.addRuleInstance(AggregateExpandDistinctAggregatesRule.INSTANCE)
.addRuleInstance(ProjectMergeRule.INSTANCE)
.build();
checkPlanning(program,
"select deptno, job, count(distinct ename), sum(sal)"
+ " from sales.emp group by rollup(deptno,job)");
}
开发者ID:apache,项目名称:calcite,代码行数:10,代码来源:RelOptRulesTest.java
示例14: testDistinctNonDistinctAggregates
import org.apache.calcite.rel.rules.AggregateExpandDistinctAggregatesRule; //导入依赖的package包/类
@Test public void testDistinctNonDistinctAggregates() {
final String sql = "select emp.empno, count(*), avg(distinct dept.deptno)\n"
+ "from sales.emp emp inner join sales.dept dept\n"
+ "on emp.deptno = dept.deptno\n"
+ "group by emp.empno";
final HepProgram program = HepProgram.builder()
.addRuleInstance(AggregateExpandDistinctAggregatesRule.JOIN)
.build();
sql(sql).with(program).check();
}
开发者ID:apache,项目名称:calcite,代码行数:11,代码来源:RelOptRulesTest.java
示例15: testCastInAggregateExpandDistinctAggregatesRule
import org.apache.calcite.rel.rules.AggregateExpandDistinctAggregatesRule; //导入依赖的package包/类
/** Test case for
* <a href="https://issues.apache.org/jira/browse/CALCITE-1621">[CALCITE-1621]
* Adding a cast around the null literal in aggregate rules</a>. */
@Test public void testCastInAggregateExpandDistinctAggregatesRule() {
final String sql = "select name, sum(distinct cn), sum(distinct sm)\n"
+ "from (\n"
+ " select name, count(dept.deptno) as cn,sum(dept.deptno) as sm\n"
+ " from sales.dept group by name)\n"
+ "group by name";
final HepProgram program = HepProgram.builder()
.addRuleInstance(AggregateExpandDistinctAggregatesRule.INSTANCE)
.build();
sql(sql).with(program).check();
}
开发者ID:apache,项目名称:calcite,代码行数:15,代码来源:RelOptRulesTest.java
示例16: testDistinctNonDistinctAggregatesWithGrouping1
import org.apache.calcite.rel.rules.AggregateExpandDistinctAggregatesRule; //导入依赖的package包/类
/** Test case for
* <a href="https://issues.apache.org/jira/browse/CALCITE-1558">[CALCITE-1558]
* AggregateExpandDistinctAggregatesRule gets field mapping wrong if groupKey
* is used in aggregate function</a>. */
@Test public void testDistinctNonDistinctAggregatesWithGrouping1() {
final String sql = "SELECT deptno,\n"
+ " SUM(deptno), SUM(DISTINCT sal), MAX(deptno), MAX(comm)\n"
+ "FROM emp\n"
+ "GROUP BY deptno";
HepProgram program = new HepProgramBuilder()
.addRuleInstance(AggregateExpandDistinctAggregatesRule.JOIN)
.build();
sql(sql).with(program).check();
}
开发者ID:apache,项目名称:calcite,代码行数:15,代码来源:RelOptRulesTest.java
示例17: testDistinctNonDistinctAggregatesWithGrouping2
import org.apache.calcite.rel.rules.AggregateExpandDistinctAggregatesRule; //导入依赖的package包/类
@Test public void testDistinctNonDistinctAggregatesWithGrouping2() {
final String sql = "SELECT deptno, COUNT(deptno), SUM(DISTINCT sal)\n"
+ "FROM emp\n"
+ "GROUP BY deptno";
HepProgram program = new HepProgramBuilder()
.addRuleInstance(AggregateExpandDistinctAggregatesRule.JOIN)
.build();
sql(sql).with(program).check();
}
开发者ID:apache,项目名称:calcite,代码行数:10,代码来源:RelOptRulesTest.java
示例18: testDistinctNonDistinctTwoAggregatesWithGrouping
import org.apache.calcite.rel.rules.AggregateExpandDistinctAggregatesRule; //导入依赖的package包/类
@Test public void testDistinctNonDistinctTwoAggregatesWithGrouping() {
final String sql = "SELECT deptno, SUM(comm), MIN(comm), SUM(DISTINCT sal)\n"
+ "FROM emp\n"
+ "GROUP BY deptno";
HepProgram program = new HepProgramBuilder()
.addRuleInstance(AggregateExpandDistinctAggregatesRule.JOIN)
.build();
sql(sql).with(program).check();
}
开发者ID:apache,项目名称:calcite,代码行数:10,代码来源:RelOptRulesTest.java
示例19: testDistinctWithGrouping
import org.apache.calcite.rel.rules.AggregateExpandDistinctAggregatesRule; //导入依赖的package包/类
@Test public void testDistinctWithGrouping() {
final String sql = "SELECT sal, SUM(comm), MIN(comm), SUM(DISTINCT sal)\n"
+ "FROM emp\n"
+ "GROUP BY sal";
HepProgram program = new HepProgramBuilder()
.addRuleInstance(AggregateExpandDistinctAggregatesRule.JOIN)
.build();
sql(sql).with(program).check();
}
开发者ID:apache,项目名称:calcite,代码行数:10,代码来源:RelOptRulesTest.java
示例20: testMultipleDistinctWithGrouping
import org.apache.calcite.rel.rules.AggregateExpandDistinctAggregatesRule; //导入依赖的package包/类
@Test public void testMultipleDistinctWithGrouping() {
final String sql = "SELECT sal, SUM(comm), MIN(DISTINCT comm), SUM(DISTINCT sal)\n"
+ "FROM emp\n"
+ "GROUP BY sal";
HepProgram program = new HepProgramBuilder()
.addRuleInstance(AggregateExpandDistinctAggregatesRule.JOIN)
.build();
sql(sql).with(program).check();
}
开发者ID:apache,项目名称:calcite,代码行数:10,代码来源:RelOptRulesTest.java
注:本文中的org.apache.calcite.rel.rules.AggregateExpandDistinctAggregatesRule类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论