KYLIN-2348 let choose model freely for sub-queries
Project: http://git-wip-us.apache.org/repos/asf/kylin/repo Commit: http://git-wip-us.apache.org/repos/asf/kylin/commit/d52bb8bc Tree: http://git-wip-us.apache.org/repos/asf/kylin/tree/d52bb8bc Diff: http://git-wip-us.apache.org/repos/asf/kylin/diff/d52bb8bc Branch: refs/heads/master-hbase1.x Commit: d52bb8bc05bd530362fe0970b8e8a85f8b2289bc Parents: 51c6571 Author: Li Yang <liy...@apache.org> Authored: Wed Jan 18 22:46:24 2017 +0800 Committer: Li Yang <liy...@apache.org> Committed: Wed Jan 18 22:46:24 2017 +0800 ---------------------------------------------------------------------- .../apache/kylin/query/relnode/OLAPTableScan.java | 2 ++ .../apache/kylin/query/routing/ModelChooser.java | 16 ++++++++-------- 2 files changed, 10 insertions(+), 8 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/kylin/blob/d52bb8bc/query/src/main/java/org/apache/kylin/query/relnode/OLAPTableScan.java ---------------------------------------------------------------------- diff --git a/query/src/main/java/org/apache/kylin/query/relnode/OLAPTableScan.java b/query/src/main/java/org/apache/kylin/query/relnode/OLAPTableScan.java index 452170a..f7877be 100644 --- a/query/src/main/java/org/apache/kylin/query/relnode/OLAPTableScan.java +++ b/query/src/main/java/org/apache/kylin/query/relnode/OLAPTableScan.java @@ -53,6 +53,7 @@ import org.apache.calcite.rel.rules.JoinPushExpressionsRule; import org.apache.calcite.rel.rules.JoinPushThroughJoinRule; import org.apache.calcite.rel.rules.JoinUnionTransposeRule; import org.apache.calcite.rel.rules.ReduceExpressionsRule; +import org.apache.calcite.rel.rules.SemiJoinRule; import org.apache.calcite.rel.rules.SortJoinTransposeRule; import org.apache.calcite.rel.rules.SortUnionTransposeRule; import org.apache.calcite.rel.type.RelDataType; @@ -174,6 +175,7 @@ public class OLAPTableScan extends TableScan implements OLAPRel, EnumerableRel { planner.removeRule(JoinUnionTransposeRule.RIGHT_UNION); planner.removeRule(AggregateUnionTransposeRule.INSTANCE); planner.removeRule(DateRangeRules.FILTER_INSTANCE); + planner.removeRule(SemiJoinRule.INSTANCE); // distinct count will be split into a separated query that is joined with the left query planner.removeRule(AggregateExpandDistinctAggregatesRule.INSTANCE); http://git-wip-us.apache.org/repos/asf/kylin/blob/d52bb8bc/query/src/main/java/org/apache/kylin/query/routing/ModelChooser.java ---------------------------------------------------------------------- diff --git a/query/src/main/java/org/apache/kylin/query/routing/ModelChooser.java b/query/src/main/java/org/apache/kylin/query/routing/ModelChooser.java index 2517dc5..f979f7b 100644 --- a/query/src/main/java/org/apache/kylin/query/routing/ModelChooser.java +++ b/query/src/main/java/org/apache/kylin/query/routing/ModelChooser.java @@ -53,17 +53,17 @@ public class ModelChooser { IdentityHashMap<OLAPContext, Set<IRealization>> candidates = new IdentityHashMap<>(); // attempt one model for all contexts - Set<IRealization> reals = attemptSelectModel(contexts); - if (reals != null) { - for (OLAPContext ctx : contexts) { - candidates.put(ctx, reals); - } - return candidates; - } + // Set<IRealization> reals = attemptSelectModel(contexts); + // if (reals != null) { + // for (OLAPContext ctx : contexts) { + // candidates.put(ctx, reals); + // } + // return candidates; + // } // try different model for different context for (OLAPContext ctx : contexts) { - reals = attemptSelectModel(ImmutableList.of(ctx)); + Set<IRealization> reals = attemptSelectModel(ImmutableList.of(ctx)); if (reals == null) throw new NoRealizationFoundException("No model found for" + toErrorMsg(ctx));