You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@phoenix.apache.org by ma...@apache.org on 2016/07/20 19:42:46 UTC
[1/2] phoenix git commit: Bind parameter bug fix
Repository: phoenix
Updated Branches:
refs/heads/calcite b1cb17d9c -> 2ee0293c3
Bind parameter bug fix
Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo
Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/496a2046
Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/496a2046
Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/496a2046
Branch: refs/heads/calcite
Commit: 496a204632b90dc57706ddfb1766fb1e50b49f46
Parents: b1cb17d
Author: maryannxue <ma...@gmail.com>
Authored: Wed Jul 20 14:17:32 2016 -0400
Committer: maryannxue <ma...@gmail.com>
Committed: Wed Jul 20 14:17:32 2016 -0400
----------------------------------------------------------------------
.../main/java/org/apache/phoenix/execute/RuntimeContextImpl.java | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/phoenix/blob/496a2046/phoenix-core/src/main/java/org/apache/phoenix/execute/RuntimeContextImpl.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/main/java/org/apache/phoenix/execute/RuntimeContextImpl.java b/phoenix-core/src/main/java/org/apache/phoenix/execute/RuntimeContextImpl.java
index ab375ea..a06e505 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/execute/RuntimeContextImpl.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/execute/RuntimeContextImpl.java
@@ -47,7 +47,7 @@ public class RuntimeContextImpl implements RuntimeContext {
@Override
public void setBindParameterValues(Map<String, Object> values) {
- this.parameters = ImmutableMap.copyOf(values);
+ this.parameters = values;
}
@Override
[2/2] phoenix git commit: Bug fixes
Posted by ma...@apache.org.
Bug fixes
Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo
Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/2ee0293c
Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/2ee0293c
Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/2ee0293c
Branch: refs/heads/calcite
Commit: 2ee0293c3a1a249a5fed559b2f0d47f1b0d42567
Parents: 496a204
Author: maryannxue <ma...@gmail.com>
Authored: Wed Jul 20 15:42:38 2016 -0400
Committer: maryannxue <ma...@gmail.com>
Committed: Wed Jul 20 15:42:38 2016 -0400
----------------------------------------------------------------------
.../org/apache/phoenix/calcite/CalciteIT.java | 8 +-
.../src/main/codegen/includes/parserImpls.ftl | 15 ++--
.../calcite/jdbc/PhoenixPrepareImpl.java | 2 -
.../calcite/rel/PhoenixCompactClientSort.java | 90 --------------------
.../phoenix/calcite/rel/PhoenixConvention.java | 3 +
.../calcite/rel/PhoenixServerAggregate.java | 2 +-
.../phoenix/calcite/rel/PhoenixServerSort.java | 61 +++++++++++--
.../rules/PhoenixCompactClientSortRule.java | 29 -------
.../calcite/rules/PhoenixConverterRules.java | 9 +-
9 files changed, 78 insertions(+), 141 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/phoenix/blob/2ee0293c/phoenix-core/src/it/java/org/apache/phoenix/calcite/CalciteIT.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/it/java/org/apache/phoenix/calcite/CalciteIT.java b/phoenix-core/src/it/java/org/apache/phoenix/calcite/CalciteIT.java
index ab43658..a786c06 100644
--- a/phoenix-core/src/it/java/org/apache/phoenix/calcite/CalciteIT.java
+++ b/phoenix-core/src/it/java/org/apache/phoenix/calcite/CalciteIT.java
@@ -559,7 +559,7 @@ public class CalciteIT extends BaseCalciteIT {
start(false, 1000f).sql("select count(entity_id), a_string from atable group by a_string order by count(entity_id), a_string desc")
.explainIs("PhoenixToEnumerableConverter\n" +
" PhoenixClientProject(EXPR$0=[$1], A_STRING=[$0])\n" +
- " PhoenixCompactClientSort(sort0=[$1], sort1=[$0], dir0=[ASC], dir1=[DESC])\n" +
+ " PhoenixServerSort(sort0=[$1], sort1=[$0], dir0=[ASC], dir1=[DESC])\n" +
" PhoenixServerAggregate(group=[{2}], EXPR$0=[COUNT()], isOrdered=[false])\n" +
" PhoenixTableScan(table=[[phoenix, ATABLE]])\n")
.resultIs(new Object[][] {
@@ -570,7 +570,7 @@ public class CalciteIT extends BaseCalciteIT {
start(false, 1000f).sql("select s.name, count(\"item_id\") from " + JOIN_SUPPLIER_TABLE_FULL_NAME + " s join " + JOIN_ITEM_TABLE_FULL_NAME + " i on s.\"supplier_id\" = i.\"supplier_id\" group by s.name order by count(\"item_id\"), s.name desc")
.explainIs("PhoenixToEnumerableConverter\n" +
- " PhoenixCompactClientSort(sort0=[$1], sort1=[$0], dir0=[ASC], dir1=[DESC])\n" +
+ " PhoenixServerSort(sort0=[$1], sort1=[$0], dir0=[ASC], dir1=[DESC])\n" +
" PhoenixServerAggregate(group=[{1}], EXPR$1=[COUNT()], isOrdered=[false])\n" +
" PhoenixServerJoin(condition=[=($0, $2)], joinType=[inner])\n" +
" PhoenixServerProject(supplier_id=[$0], NAME=[$1])\n" +
@@ -675,7 +675,7 @@ public class CalciteIT extends BaseCalciteIT {
.explainIs("PhoenixToEnumerableConverter\n" +
" PhoenixClientProject(EXPR$0=[$1], A_STRING=[$0])\n" +
" PhoenixLimit(fetch=[2])\n" +
- " PhoenixCompactClientSort(sort0=[$1], sort1=[$0], dir0=[ASC], dir1=[DESC])\n" +
+ " PhoenixServerSort(sort0=[$1], sort1=[$0], dir0=[ASC], dir1=[DESC])\n" +
" PhoenixServerAggregate(group=[{2}], EXPR$0=[COUNT()], isOrdered=[false])\n" +
" PhoenixTableScan(table=[[phoenix, ATABLE]])\n")
.resultIs(new Object[][] {
@@ -686,7 +686,7 @@ public class CalciteIT extends BaseCalciteIT {
start(false, 1000f).sql("select s.name, count(\"item_id\") from " + JOIN_SUPPLIER_TABLE_FULL_NAME + " s join " + JOIN_ITEM_TABLE_FULL_NAME + " i on s.\"supplier_id\" = i.\"supplier_id\" group by s.name order by count(\"item_id\"), s.name desc limit 3")
.explainIs("PhoenixToEnumerableConverter\n" +
" PhoenixLimit(fetch=[3])\n" +
- " PhoenixCompactClientSort(sort0=[$1], sort1=[$0], dir0=[ASC], dir1=[DESC])\n" +
+ " PhoenixServerSort(sort0=[$1], sort1=[$0], dir0=[ASC], dir1=[DESC])\n" +
" PhoenixServerAggregate(group=[{1}], EXPR$1=[COUNT()], isOrdered=[false])\n" +
" PhoenixServerJoin(condition=[=($0, $2)], joinType=[inner])\n" +
" PhoenixServerProject(supplier_id=[$0], NAME=[$1])\n" +
http://git-wip-us.apache.org/repos/asf/phoenix/blob/2ee0293c/phoenix-core/src/main/codegen/includes/parserImpls.ftl
----------------------------------------------------------------------
diff --git a/phoenix-core/src/main/codegen/includes/parserImpls.ftl b/phoenix-core/src/main/codegen/includes/parserImpls.ftl
index 6915ef5..383e5b4 100644
--- a/phoenix-core/src/main/codegen/includes/parserImpls.ftl
+++ b/phoenix-core/src/main/codegen/includes/parserImpls.ftl
@@ -352,13 +352,14 @@ SqlDataTypeNode PhoenixDataType() :
<RPAREN>
]
[
- <ARRAY>
- {isArray = true;}
- [
- <LBRACKET>
- arrSize = UnsignedIntLiteral()
- <RBRACKET>
- ]
+ <ARRAY> { isArray = true; }
+ ]
+ [
+ <LBRACKET> { isArray = true; }
+ [
+ arrSize = UnsignedIntLiteral()
+ ]
+ <RBRACKET>
]
{
pos = typeName.getParserPosition().plus(getPos());
http://git-wip-us.apache.org/repos/asf/phoenix/blob/2ee0293c/phoenix-core/src/main/java/org/apache/phoenix/calcite/jdbc/PhoenixPrepareImpl.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/main/java/org/apache/phoenix/calcite/jdbc/PhoenixPrepareImpl.java b/phoenix-core/src/main/java/org/apache/phoenix/calcite/jdbc/PhoenixPrepareImpl.java
index f250ae6..24dcbaf 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/calcite/jdbc/PhoenixPrepareImpl.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/calcite/jdbc/PhoenixPrepareImpl.java
@@ -42,7 +42,6 @@ import org.apache.phoenix.calcite.parser.PhoenixParserImpl;
import org.apache.phoenix.calcite.rel.PhoenixRel;
import org.apache.phoenix.calcite.rel.PhoenixServerProject;
import org.apache.phoenix.calcite.rel.PhoenixTemporarySort;
-import org.apache.phoenix.calcite.rules.PhoenixCompactClientSortRule;
import org.apache.phoenix.calcite.rules.PhoenixFilterScanMergeRule;
import org.apache.phoenix.calcite.rules.PhoenixForwardTableScanRule;
import org.apache.phoenix.calcite.rules.PhoenixJoinSingleValueAggregateMergeRule;
@@ -126,7 +125,6 @@ public class PhoenixPrepareImpl extends CalcitePrepareImpl {
}
planner.addRule(PhoenixFilterScanMergeRule.INSTANCE);
planner.addRule(PhoenixTableScanColumnRefRule.INSTANCE);
- planner.addRule(PhoenixCompactClientSortRule.INSTANCE);
planner.addRule(PhoenixJoinSingleValueAggregateMergeRule.INSTANCE);
planner.addRule(PhoenixMergeSortUnionRule.INSTANCE);
planner.addRule(PhoenixOrderedAggregateRule.INSTANCE);
http://git-wip-us.apache.org/repos/asf/phoenix/blob/2ee0293c/phoenix-core/src/main/java/org/apache/phoenix/calcite/rel/PhoenixCompactClientSort.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/main/java/org/apache/phoenix/calcite/rel/PhoenixCompactClientSort.java b/phoenix-core/src/main/java/org/apache/phoenix/calcite/rel/PhoenixCompactClientSort.java
deleted file mode 100644
index 35514fb..0000000
--- a/phoenix-core/src/main/java/org/apache/phoenix/calcite/rel/PhoenixCompactClientSort.java
+++ /dev/null
@@ -1,90 +0,0 @@
-package org.apache.phoenix.calcite.rel;
-
-import org.apache.calcite.plan.RelOptCluster;
-import org.apache.calcite.plan.RelOptCost;
-import org.apache.calcite.plan.RelOptPlanner;
-import org.apache.calcite.plan.RelTraitSet;
-import org.apache.calcite.rel.RelCollation;
-import org.apache.calcite.rel.RelCollationTraitDef;
-import org.apache.calcite.rel.RelNode;
-import org.apache.calcite.rel.metadata.RelMetadataQuery;
-import org.apache.calcite.rex.RexNode;
-import org.apache.phoenix.compile.QueryPlan;
-import org.apache.phoenix.compile.OrderByCompiler.OrderBy;
-import org.apache.phoenix.execute.HashJoinPlan;
-import org.apache.phoenix.execute.AggregatePlan;
-import org.apache.phoenix.execute.TupleProjectionPlan;
-import org.apache.phoenix.execute.TupleProjector;
-
-public class PhoenixCompactClientSort extends PhoenixAbstractSort {
-
- public static PhoenixCompactClientSort create(RelNode input, RelCollation collation) {
- RelOptCluster cluster = input.getCluster();
- collation = RelCollationTraitDef.INSTANCE.canonize(collation);
- RelTraitSet traits =
- input.getTraitSet().replace(PhoenixConvention.CLIENT).replace(collation);
- return new PhoenixCompactClientSort(cluster, traits, input, collation);
- }
-
- private PhoenixCompactClientSort(RelOptCluster cluster, RelTraitSet traits,
- RelNode child, RelCollation collation) {
- super(cluster, traits, child, collation);
- }
-
- @Override
- public PhoenixCompactClientSort copy(RelTraitSet traitSet, RelNode newInput,
- RelCollation newCollation, RexNode offset, RexNode fetch) {
- return create(newInput, newCollation);
- }
-
- @Override
- public RelOptCost computeSelfCost(RelOptPlanner planner, RelMetadataQuery mq) {
- if (!getInput().getConvention().satisfies(PhoenixConvention.CLIENT))
- return planner.getCostFactory().makeInfiniteCost();
-
- return super.computeSelfCost(planner, mq)
- .multiplyBy(SERVER_FACTOR)
- .multiplyBy(PHOENIX_FACTOR);
- }
-
- @Override
- public QueryPlan implement(PhoenixRelImplementor implementor) {
- if (this.offset != null)
- throw new UnsupportedOperationException();
-
- QueryPlan plan = implementor.visitInput(0, (PhoenixQueryRel) getInput());
- assert plan instanceof TupleProjectionPlan;
-
- // PhoenixServerAggregate wraps the AggregatePlan with a TupleProjectionPlan,
- // so we need to unwrap the TupleProjectionPlan.
- TupleProjectionPlan tupleProjectionPlan = (TupleProjectionPlan) plan;
- assert tupleProjectionPlan.getPostFilter() == null;
- QueryPlan innerPlan = tupleProjectionPlan.getDelegate();
- TupleProjector tupleProjector = tupleProjectionPlan.getTupleProjector();
- assert (innerPlan instanceof AggregatePlan
- || innerPlan instanceof HashJoinPlan)
- && innerPlan.getLimit() == null;
-
- AggregatePlan basePlan;
- HashJoinPlan hashJoinPlan = null;
- if (innerPlan instanceof AggregatePlan) {
- basePlan = (AggregatePlan) innerPlan;
- } else {
- hashJoinPlan = (HashJoinPlan) innerPlan;
- QueryPlan delegate = hashJoinPlan.getDelegate();
- assert delegate instanceof AggregatePlan;
- basePlan = (AggregatePlan) delegate;
- }
-
- OrderBy orderBy = super.getOrderBy(getCollation(), implementor, tupleProjector);
- QueryPlan newPlan = AggregatePlan.create((AggregatePlan) basePlan, orderBy);
-
- if (hashJoinPlan != null) {
- newPlan = HashJoinPlan.create(hashJoinPlan.getStatement(), newPlan, hashJoinPlan.getJoinInfo(), hashJoinPlan.getSubPlans());
- }
- // Recover the wrapping of TupleProjectionPlan
- newPlan = new TupleProjectionPlan(newPlan, tupleProjector, null);
- return newPlan;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/phoenix/blob/2ee0293c/phoenix-core/src/main/java/org/apache/phoenix/calcite/rel/PhoenixConvention.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/main/java/org/apache/phoenix/calcite/rel/PhoenixConvention.java b/phoenix-core/src/main/java/org/apache/phoenix/calcite/rel/PhoenixConvention.java
index af9be9d..de97a4a 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/calcite/rel/PhoenixConvention.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/calcite/rel/PhoenixConvention.java
@@ -18,6 +18,9 @@ public enum PhoenixConvention implements Convention {
/** Server join convention*/
SERVERJOIN,
+ /** Server join convention*/
+ SERVERAGG,
+
/** Client convention*/
CLIENT,
http://git-wip-us.apache.org/repos/asf/phoenix/blob/2ee0293c/phoenix-core/src/main/java/org/apache/phoenix/calcite/rel/PhoenixServerAggregate.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/main/java/org/apache/phoenix/calcite/rel/PhoenixServerAggregate.java b/phoenix-core/src/main/java/org/apache/phoenix/calcite/rel/PhoenixServerAggregate.java
index 4177764..8c82f10 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/calcite/rel/PhoenixServerAggregate.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/calcite/rel/PhoenixServerAggregate.java
@@ -26,7 +26,7 @@ public class PhoenixServerAggregate extends PhoenixAbstractAggregate {
ImmutableBitSet groupSet, List<ImmutableBitSet> groupSets,
List<AggregateCall> aggCalls) {
RelOptCluster cluster = input.getCluster();
- RelTraitSet traits = cluster.traitSetOf(PhoenixConvention.CLIENT);
+ RelTraitSet traits = cluster.traitSetOf(PhoenixConvention.SERVERAGG);
return new PhoenixServerAggregate(cluster, traits, input, indicator,
groupSet, groupSets, aggCalls);
}
http://git-wip-us.apache.org/repos/asf/phoenix/blob/2ee0293c/phoenix-core/src/main/java/org/apache/phoenix/calcite/rel/PhoenixServerSort.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/main/java/org/apache/phoenix/calcite/rel/PhoenixServerSort.java b/phoenix-core/src/main/java/org/apache/phoenix/calcite/rel/PhoenixServerSort.java
index 9ace803..345f1ef 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/calcite/rel/PhoenixServerSort.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/calcite/rel/PhoenixServerSort.java
@@ -13,8 +13,11 @@ import org.apache.calcite.rel.metadata.RelMetadataQuery;
import org.apache.calcite.rex.RexNode;
import org.apache.phoenix.compile.OrderByCompiler.OrderBy;
import org.apache.phoenix.compile.QueryPlan;
+import org.apache.phoenix.execute.AggregatePlan;
import org.apache.phoenix.execute.HashJoinPlan;
import org.apache.phoenix.execute.ScanPlan;
+import org.apache.phoenix.execute.TupleProjectionPlan;
+import org.apache.phoenix.execute.TupleProjector;
public class PhoenixServerSort extends PhoenixAbstractSort {
@@ -40,7 +43,8 @@ public class PhoenixServerSort extends PhoenixAbstractSort {
@Override
public RelOptCost computeSelfCost(RelOptPlanner planner, RelMetadataQuery mq) {
if (!getInput().getConvention().satisfies(PhoenixConvention.SERVER)
- && !getInput().getConvention().satisfies(PhoenixConvention.SERVERJOIN))
+ && !getInput().getConvention().satisfies(PhoenixConvention.SERVERJOIN)
+ && !getInput().getConvention().satisfies(PhoenixConvention.SERVERAGG))
return planner.getCostFactory().makeInfiniteCost();
return super.computeSelfCost(planner, mq)
@@ -54,10 +58,19 @@ public class PhoenixServerSort extends PhoenixAbstractSort {
throw new UnsupportedOperationException();
QueryPlan plan = implementor.visitInput(0, (PhoenixQueryRel) getInput());
- assert (plan instanceof ScanPlan
- || plan instanceof HashJoinPlan)
- && plan.getLimit() == null;
+ if (getInput().getConvention().satisfies(PhoenixConvention.SERVERAGG)) {
+ return sortOverAgg(implementor, plan);
+ }
+
+ return sortOverScan(implementor, plan);
+ }
+
+ private QueryPlan sortOverScan(PhoenixRelImplementor implementor, QueryPlan plan) {
+ assert (plan instanceof ScanPlan
+ || plan instanceof HashJoinPlan)
+ && plan.getLimit() == null;
+
ScanPlan basePlan;
HashJoinPlan hashJoinPlan = null;
if (plan instanceof ScanPlan) {
@@ -68,7 +81,7 @@ public class PhoenixServerSort extends PhoenixAbstractSort {
assert delegate instanceof ScanPlan;
basePlan = (ScanPlan) delegate;
}
-
+
OrderBy orderBy = super.getOrderBy(getCollation(), implementor, null);
QueryPlan newPlan;
try {
@@ -76,11 +89,45 @@ public class PhoenixServerSort extends PhoenixAbstractSort {
} catch (SQLException e) {
throw new RuntimeException(e);
}
-
+
if (hashJoinPlan != null) {
newPlan = HashJoinPlan.create(hashJoinPlan.getStatement(), newPlan, hashJoinPlan.getJoinInfo(), hashJoinPlan.getSubPlans());
}
return newPlan;
}
-
+
+ private QueryPlan sortOverAgg(PhoenixRelImplementor implementor, QueryPlan plan) {
+ assert plan instanceof TupleProjectionPlan;
+
+ // PhoenixServerAggregate wraps the AggregatePlan with a TupleProjectionPlan,
+ // so we need to unwrap the TupleProjectionPlan.
+ TupleProjectionPlan tupleProjectionPlan = (TupleProjectionPlan) plan;
+ assert tupleProjectionPlan.getPostFilter() == null;
+ QueryPlan innerPlan = tupleProjectionPlan.getDelegate();
+ TupleProjector tupleProjector = tupleProjectionPlan.getTupleProjector();
+ assert (innerPlan instanceof AggregatePlan
+ || innerPlan instanceof HashJoinPlan)
+ && innerPlan.getLimit() == null;
+
+ AggregatePlan basePlan;
+ HashJoinPlan hashJoinPlan = null;
+ if (innerPlan instanceof AggregatePlan) {
+ basePlan = (AggregatePlan) innerPlan;
+ } else {
+ hashJoinPlan = (HashJoinPlan) innerPlan;
+ QueryPlan delegate = hashJoinPlan.getDelegate();
+ assert delegate instanceof AggregatePlan;
+ basePlan = (AggregatePlan) delegate;
+ }
+
+ OrderBy orderBy = super.getOrderBy(getCollation(), implementor, tupleProjector);
+ QueryPlan newPlan = AggregatePlan.create((AggregatePlan) basePlan, orderBy);
+
+ if (hashJoinPlan != null) {
+ newPlan = HashJoinPlan.create(hashJoinPlan.getStatement(), newPlan, hashJoinPlan.getJoinInfo(), hashJoinPlan.getSubPlans());
+ }
+ // Recover the wrapping of TupleProjectionPlan
+ newPlan = new TupleProjectionPlan(newPlan, tupleProjector, null);
+ return newPlan;
+ }
}
http://git-wip-us.apache.org/repos/asf/phoenix/blob/2ee0293c/phoenix-core/src/main/java/org/apache/phoenix/calcite/rules/PhoenixCompactClientSortRule.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/main/java/org/apache/phoenix/calcite/rules/PhoenixCompactClientSortRule.java b/phoenix-core/src/main/java/org/apache/phoenix/calcite/rules/PhoenixCompactClientSortRule.java
deleted file mode 100644
index b7af899..0000000
--- a/phoenix-core/src/main/java/org/apache/phoenix/calcite/rules/PhoenixCompactClientSortRule.java
+++ /dev/null
@@ -1,29 +0,0 @@
-package org.apache.phoenix.calcite.rules;
-
-import org.apache.calcite.plan.RelOptRule;
-import org.apache.calcite.plan.RelOptRuleCall;
-import org.apache.phoenix.calcite.rel.PhoenixClientSort;
-import org.apache.phoenix.calcite.rel.PhoenixCompactClientSort;
-import org.apache.phoenix.calcite.rel.PhoenixRel;
-import org.apache.phoenix.calcite.rel.PhoenixServerAggregate;
-
-public class PhoenixCompactClientSortRule extends RelOptRule {
-
- public static final PhoenixCompactClientSortRule INSTANCE =
- new PhoenixCompactClientSortRule();
-
- public PhoenixCompactClientSortRule() {
- super(
- operand(PhoenixClientSort.class,
- operand(PhoenixServerAggregate.class, any())));
- }
-
- @Override
- public void onMatch(RelOptRuleCall call) {
- PhoenixClientSort sort = call.rel(0);
- PhoenixRel input = call.rel(1);
- call.transformTo(PhoenixCompactClientSort.create(
- input, sort.getCollation()));
- }
-
-}
http://git-wip-us.apache.org/repos/asf/phoenix/blob/2ee0293c/phoenix-core/src/main/java/org/apache/phoenix/calcite/rules/PhoenixConverterRules.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/main/java/org/apache/phoenix/calcite/rules/PhoenixConverterRules.java b/phoenix-core/src/main/java/org/apache/phoenix/calcite/rules/PhoenixConverterRules.java
index 58ff7cc..4347aa5 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/calcite/rules/PhoenixConverterRules.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/calcite/rules/PhoenixConverterRules.java
@@ -75,11 +75,13 @@ public class PhoenixConverterRules {
public static final RelOptRule[] RULES = {
PhoenixToEnumerableConverterRule.SERVER,
PhoenixToEnumerableConverterRule.SERVERJOIN,
+ PhoenixToEnumerableConverterRule.SERVERAGG,
PhoenixToEnumerableConverterRule.CLIENT,
PhoenixToEnumerableConverterRule.MUTATION,
PhoenixClientSortRule.INSTANCE,
PhoenixServerSortRule.SERVER,
PhoenixServerSortRule.SERVERJOIN,
+ PhoenixServerSortRule.SERVERAGG,
PhoenixLimitRule.INSTANCE,
PhoenixFilterRule.INSTANCE,
PhoenixClientProjectRule.INSTANCE,
@@ -101,11 +103,13 @@ public class PhoenixConverterRules {
public static final RelOptRule[] CONVERTIBLE_RULES = {
PhoenixToEnumerableConverterRule.SERVER,
PhoenixToEnumerableConverterRule.SERVERJOIN,
+ PhoenixToEnumerableConverterRule.SERVERAGG,
PhoenixToEnumerableConverterRule.CLIENT,
PhoenixToEnumerableConverterRule.MUTATION,
PhoenixClientSortRule.INSTANCE,
PhoenixServerSortRule.SERVER,
PhoenixServerSortRule.SERVERJOIN,
+ PhoenixServerSortRule.SERVERAGG,
PhoenixLimitRule.INSTANCE,
PhoenixFilterRule.CONVERTIBLE,
PhoenixClientProjectRule.CONVERTIBLE,
@@ -198,6 +202,7 @@ public class PhoenixConverterRules {
public static final PhoenixServerSortRule SERVER = new PhoenixServerSortRule(PhoenixConvention.SERVER);
public static final PhoenixServerSortRule SERVERJOIN = new PhoenixServerSortRule(PhoenixConvention.SERVERJOIN);
+ public static final PhoenixServerSortRule SERVERAGG = new PhoenixServerSortRule(PhoenixConvention.SERVERAGG);
private final Convention inputConvention;
@@ -422,7 +427,7 @@ public class PhoenixConverterRules {
private PhoenixServerAggregateRule(Predicate<LogicalAggregate> predicate, Convention inputConvention) {
super(LogicalAggregate.class, predicate, Convention.NONE,
- PhoenixConvention.CLIENT, "PhoenixServerAggregateRule:" + inputConvention.getName());
+ PhoenixConvention.SERVERAGG, "PhoenixServerAggregateRule:" + inputConvention.getName());
this.inputConvention = inputConvention;
}
@@ -872,6 +877,8 @@ public class PhoenixConverterRules {
new PhoenixToEnumerableConverterRule(PhoenixConvention.SERVER);
public static final ConverterRule SERVERJOIN =
new PhoenixToEnumerableConverterRule(PhoenixConvention.SERVERJOIN);
+ public static final ConverterRule SERVERAGG =
+ new PhoenixToEnumerableConverterRule(PhoenixConvention.SERVERAGG);
public static final ConverterRule CLIENT =
new PhoenixToEnumerableConverterRule(PhoenixConvention.CLIENT);
public static final ConverterRule MUTATION =