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/01/16 04:28:23 UTC
[1/2] phoenix git commit: PHOENIX-2601 Query result is incorrect when
both index hint and limit are used
Repository: phoenix
Updated Branches:
refs/heads/master 04504c34f -> 26c138fec
PHOENIX-2601 Query result is incorrect when both index hint and limit are used
Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo
Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/3c2ec562
Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/3c2ec562
Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/3c2ec562
Branch: refs/heads/master
Commit: 3c2ec562f6c347e5bfc0c1c9bc9981f8d84644ff
Parents: 763a356
Author: maryannxue <ma...@gmail.com>
Authored: Fri Jan 15 22:27:42 2016 -0500
Committer: maryannxue <ma...@gmail.com>
Committed: Fri Jan 15 22:27:42 2016 -0500
----------------------------------------------------------------------
.../index/GlobalIndexOptimizationIT.java | 23 ++++++++++++++++++++
.../apache/phoenix/optimize/QueryOptimizer.java | 2 +-
2 files changed, 24 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/phoenix/blob/3c2ec562/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/GlobalIndexOptimizationIT.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/GlobalIndexOptimizationIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/GlobalIndexOptimizationIT.java
index b97176f..10634b8 100644
--- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/GlobalIndexOptimizationIT.java
+++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/GlobalIndexOptimizationIT.java
@@ -157,6 +157,29 @@ public class GlobalIndexOptimizationIT extends BaseHBaseManagedTimeIT {
assertEquals("a", rs.getString("v1"));
assertFalse(rs.next());
+ query = "SELECT /*+ INDEX(" + TestUtil.DEFAULT_DATA_TABLE_NAME + " " + TestUtil.DEFAULT_INDEX_TABLE_NAME + ")*/ * FROM " + TestUtil.DEFAULT_DATA_TABLE_NAME +" where v1='a' limit 1";
+ rs = conn1.createStatement().executeQuery("EXPLAIN "+ query);
+
+ expected =
+ "CLIENT PARALLEL 1-WAY FULL SCAN OVER " + TestUtil.DEFAULT_DATA_TABLE_NAME + "\n" +
+ "CLIENT 1 ROW LIMIT\n" +
+ " SKIP-SCAN-JOIN TABLE 0\n" +
+ " CLIENT PARALLEL 1-WAY RANGE SCAN OVER " + TestUtil.DEFAULT_INDEX_TABLE_NAME + " \\['a'\\]\n" +
+ " SERVER FILTER BY FIRST KEY ONLY\n" +
+ " DYNAMIC SERVER FILTER BY \\(\"T.T_ID\", \"T.K1\", \"T.K2\"\\) IN \\(\\(\\$\\d+.\\$\\d+, \\$\\d+.\\$\\d+, \\$\\d+.\\$\\d+\\)\\)\n" +
+ " JOIN-SCANNER 1 ROW LIMIT";
+ actual = QueryUtil.getExplainPlan(rs);
+ assertTrue("Expected:\n" + expected + "\nbut got\n" + actual, Pattern.matches(expected, actual));
+
+ rs = conn1.createStatement().executeQuery(query);
+ assertTrue(rs.next());
+ assertEquals("f", rs.getString("t_id"));
+ assertEquals(1, rs.getInt("k1"));
+ assertEquals(2, rs.getInt("k2"));
+ assertEquals(3, rs.getInt("k3"));
+ assertEquals("a", rs.getString("v1"));
+ assertFalse(rs.next());
+
query = "SELECT /*+ INDEX(" + TestUtil.DEFAULT_DATA_TABLE_NAME + " " + TestUtil.DEFAULT_INDEX_TABLE_NAME + ")*/ t_id, k1, k2, k3, V1 from " + TestUtil.DEFAULT_DATA_TABLE_FULL_NAME + " where v1<='z' and k3 > 1 order by V1,t_id";
rs = conn1.createStatement().executeQuery("EXPLAIN " + query);
http://git-wip-us.apache.org/repos/asf/phoenix/blob/3c2ec562/phoenix-core/src/main/java/org/apache/phoenix/optimize/QueryOptimizer.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/main/java/org/apache/phoenix/optimize/QueryOptimizer.java b/phoenix-core/src/main/java/org/apache/phoenix/optimize/QueryOptimizer.java
index c5ff3c6..adc3c2d 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/optimize/QueryOptimizer.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/optimize/QueryOptimizer.java
@@ -285,7 +285,7 @@ public class QueryOptimizer {
aliasedNodes.add(FACTORY.aliasedNode(null, indexColNode));
nodes.add(new ColumnParseNode(null, '"' + column.getName().getString() + '"'));
}
- SelectStatement innerSelect = FACTORY.select(indexSelect.getFrom(), indexSelect.getHint(), false, aliasedNodes, where, null, null, null, indexSelect.getLimit(), indexSelect.getBindCount(), false, indexSelect.hasSequence(), Collections.<SelectStatement>emptyList(), indexSelect.getUdfParseNodes());
+ SelectStatement innerSelect = FACTORY.select(indexSelect.getFrom(), indexSelect.getHint(), false, aliasedNodes, where, null, null, null, null, indexSelect.getBindCount(), false, indexSelect.hasSequence(), Collections.<SelectStatement>emptyList(), indexSelect.getUdfParseNodes());
ParseNode outerWhere = FACTORY.in(nodes.size() == 1 ? nodes.get(0) : FACTORY.rowValueConstructor(nodes), FACTORY.subquery(innerSelect, false), false, true);
ParseNode extractedCondition = whereRewriter.getExtractedCondition();
if (extractedCondition != null) {
[2/2] phoenix git commit: Merge branch 'master' of
https://git-wip-us.apache.org/repos/asf/phoenix
Posted by ma...@apache.org.
Merge branch 'master' of https://git-wip-us.apache.org/repos/asf/phoenix
Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo
Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/26c138fe
Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/26c138fe
Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/26c138fe
Branch: refs/heads/master
Commit: 26c138fec4acffc53f1179f3bf6ebaf43e251880
Parents: 3c2ec56 04504c3
Author: maryannxue <ma...@gmail.com>
Authored: Fri Jan 15 22:27:55 2016 -0500
Committer: maryannxue <ma...@gmail.com>
Committed: Fri Jan 15 22:27:55 2016 -0500
----------------------------------------------------------------------
.../apache/phoenix/end2end/UpsertSelectIT.java | 23 +
.../org/apache/phoenix/tx/TransactionIT.java | 442 ++++++++++---------
.../apache/phoenix/compile/DeleteCompiler.java | 1 -
.../apache/phoenix/execute/MutationState.java | 40 +-
.../apache/phoenix/jdbc/PhoenixStatement.java | 1 +
5 files changed, 281 insertions(+), 226 deletions(-)
----------------------------------------------------------------------