@Nullable @Override public Void apply(@Nullable RelOptRule input) { planner.removeRule(input); return null; } });
if (!kylinConfig.isEnumerableRulesEnabled()) { for (RelOptRule rule : CalcitePrepareImpl.ENUMERABLE_RULES) { planner.removeRule(rule); planner.removeRule(FilterJoinRule.FILTER_ON_JOIN); planner.removeRule(FilterJoinRule.JOIN); planner.removeRule(JoinCommuteRule.INSTANCE); planner.removeRule(JoinPushThroughJoinRule.LEFT); planner.removeRule(JoinPushThroughJoinRule.RIGHT); planner.removeRule(AggregateJoinTransposeRule.INSTANCE); planner.removeRule(AggregateProjectMergeRule.INSTANCE); planner.removeRule(FilterProjectTransposeRule.INSTANCE); planner.removeRule(SortJoinTransposeRule.INSTANCE); planner.removeRule(JoinPushExpressionsRule.INSTANCE); planner.removeRule(SortUnionTransposeRule.INSTANCE); planner.removeRule(JoinUnionTransposeRule.LEFT_UNION); planner.removeRule(JoinUnionTransposeRule.RIGHT_UNION); planner.removeRule(AggregateUnionTransposeRule.INSTANCE); planner.removeRule(DateRangeRules.FILTER_INSTANCE); planner.removeRule(SemiJoinRule.JOIN); planner.removeRule(SemiJoinRule.PROJECT); planner.removeRule(AggregateExpandDistinctAggregatesRule.INSTANCE); planner.removeRule(ExpandConversionRule.INSTANCE);
@Nullable @Override public Void apply(@Nullable RelOptRule input) { planner.removeRule(input); return null; } });
if (!kylinConfig.isEnumerableRulesEnabled()) { for (RelOptRule rule : CalcitePrepareImpl.ENUMERABLE_RULES) { planner.removeRule(rule); planner.removeRule(FilterJoinRule.FILTER_ON_JOIN); planner.removeRule(FilterJoinRule.JOIN); planner.removeRule(JoinCommuteRule.INSTANCE); planner.removeRule(JoinPushThroughJoinRule.LEFT); planner.removeRule(JoinPushThroughJoinRule.RIGHT); planner.removeRule(AggregateJoinTransposeRule.INSTANCE); planner.removeRule(AggregateProjectMergeRule.INSTANCE); planner.removeRule(FilterProjectTransposeRule.INSTANCE); planner.removeRule(SortJoinTransposeRule.INSTANCE); planner.removeRule(JoinPushExpressionsRule.INSTANCE); planner.removeRule(SortUnionTransposeRule.INSTANCE); planner.removeRule(JoinUnionTransposeRule.LEFT_UNION); planner.removeRule(JoinUnionTransposeRule.RIGHT_UNION); planner.removeRule(AggregateUnionTransposeRule.INSTANCE); planner.removeRule(DateRangeRules.FILTER_INSTANCE); planner.removeRule(SemiJoinRule.JOIN); planner.removeRule(SemiJoinRule.PROJECT); planner.removeRule(AggregateExpandDistinctAggregatesRule.INSTANCE); planner.removeRule(ExpandConversionRule.INSTANCE);
@Test public void testIntersect() { final String sql = "" + "select \"empid\", \"name\" from \"hr\".\"emps\" where \"deptno\"=10\n" + "intersect\n" + "select \"empid\", \"name\" from \"hr\".\"emps\" where \"empid\">=150"; CalciteAssert.hr() .query(sql) .withHook(Hook.PLANNER, (Consumer<RelOptPlanner>) planner -> planner.removeRule(IntersectToDistinctRule.INSTANCE)) .explainContains("" + "PLAN=EnumerableIntersect(all=[false])") .returnsUnordered("empid=150; name=Sebastian"); }
@Test public void testIntersect() { final String sql = "" + "select \"empid\", \"name\" from \"hr\".\"emps\" where \"deptno\"=10\n" + "intersect\n" + "select \"empid\", \"name\" from \"hr\".\"emps\" where \"empid\">=150"; CalciteAssert.hr() .query(sql) .withHook(Hook.PLANNER, (Consumer<RelOptPlanner>) planner -> planner.removeRule(IntersectToDistinctRule.INSTANCE)) .explainContains("" + "PLAN=EnumerableIntersect(all=[false])") .returnsUnordered("empid=150; name=Sebastian"); }
/** Test case for * <a href="https://issues.apache.org/jira/browse/CALCITE-2605">[CALCITE-2605] * NullPointerException when left outer join implemented with EnumerableCorrelate</a> */ @Test public void leftOuterJoinCorrelate() { tester(false, new JdbcTest.HrSchema()) .query( "select e.empid, e.name, d.name as dept from emps e left outer join depts d on e.deptno=d.deptno") .withHook(Hook.PLANNER, (Consumer<RelOptPlanner>) planner -> { // force the left outer join to run via EnumerableCorrelate instead of EnumerableJoin planner.addRule(JoinToCorrelateRule.INSTANCE); planner.removeRule(EnumerableRules.ENUMERABLE_JOIN_RULE); }) .explainContains("" + "EnumerableCalc(expr#0..4=[{inputs}], empid=[$t0], name=[$t2], dept=[$t4])\n" + " EnumerableCorrelate(correlation=[$cor0], joinType=[left], requiredColumns=[{1}])\n" + " EnumerableCalc(expr#0..4=[{inputs}], proj#0..2=[{exprs}])\n" + " EnumerableTableScan(table=[[s, emps]])\n" + " EnumerableCalc(expr#0..3=[{inputs}], expr#4=[$cor0], expr#5=[$t4.deptno], expr#6=[=($t5, $t0)], proj#0..1=[{exprs}], $condition=[$t6])\n" + " EnumerableTableScan(table=[[s, depts]])") .returnsUnordered( "empid=100; name=Bill; dept=Sales", "empid=110; name=Theodore; dept=Sales", "empid=150; name=Sebastian; dept=Sales", "empid=200; name=Eric; dept=null"); }