phoenix git commit: PHOENIX-1480 Incorrect query results may occur when VIEW uses indexes from physical table
Repository: phoenix Updated Branches: refs/heads/4.2 3dc2a8d43 - bdb724d34 PHOENIX-1480 Incorrect query results may occur when VIEW uses indexes from physical table Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/bdb724d3 Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/bdb724d3 Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/bdb724d3 Branch: refs/heads/4.2 Commit: bdb724d34ef40f96c9bba0cc46577011ac0b6518 Parents: 3dc2a8d Author: James Taylor jtay...@salesforce.com Authored: Tue Dec 2 09:22:47 2014 -0800 Committer: James Taylor jtay...@salesforce.com Committed: Tue Dec 2 09:22:47 2014 -0800 -- .../java/org/apache/phoenix/end2end/ViewIT.java | 37 +++ .../end2end/index/DropIndexDuringUpsertIT.java | 2 + .../phoenix/compile/CreateTableCompiler.java| 13 +- .../apache/phoenix/compile/FromCompiler.java| 14 +- .../phoenix/compile/IndexStatementRewriter.java | 1 + .../phoenix/compile/StatementContext.java | 4 ++ .../apache/phoenix/compile/WhereCompiler.java | 6 ++- .../apache/phoenix/compile/WhereOptimizer.java | 2 +- .../org/apache/phoenix/schema/ColumnRef.java| 30 ++--- .../apache/phoenix/schema/MetaDataClient.java | 47 +--- .../org/apache/phoenix/schema/PTableImpl.java | 10 +++-- .../org/apache/phoenix/schema/TableRef.java | 33 +- .../java/org/apache/phoenix/util/IndexUtil.java | 41 - .../java/org/apache/phoenix/util/QueryUtil.java | 14 ++ .../phoenix/compile/QueryOptimizerTest.java | 38 +++- 15 files changed, 239 insertions(+), 53 deletions(-) -- http://git-wip-us.apache.org/repos/asf/phoenix/blob/bdb724d3/phoenix-core/src/it/java/org/apache/phoenix/end2end/ViewIT.java -- diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/ViewIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ViewIT.java index bc6f20d..0b06e03 100644 --- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/ViewIT.java +++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ViewIT.java @@ -34,6 +34,7 @@ import org.apache.phoenix.exception.SQLExceptionCode; import org.apache.phoenix.query.KeyRange; import org.apache.phoenix.schema.ReadOnlyTableException; import org.apache.phoenix.schema.TableNotFoundException; +import org.apache.phoenix.util.QueryUtil; import org.junit.Test; @@ -362,4 +363,40 @@ public class ViewIT extends BaseViewIT { //Expected } } + + @Test +public void testViewUsesTableIndex() throws Exception { +ResultSet rs; +Connection conn = DriverManager.getConnection(getUrl()); +String ddl = CREATE TABLE t (k1 INTEGER NOT NULL, k2 INTEGER NOT NULL, k3 DECIMAL, s1 VARCHAR, s2 VARCHAR CONSTRAINT pk PRIMARY KEY (k1, k2, k3)); +conn.createStatement().execute(ddl); +conn.createStatement().execute(CREATE INDEX i1 ON t(k3, k2) INCLUDE(s1, s2)); +conn.createStatement().execute(CREATE INDEX i2 ON t(k3, k2, s2)); + +ddl = CREATE VIEW v AS SELECT * FROM t WHERE s1 = 'foo'; +conn.createStatement().execute(ddl); +String[] s1Values = {foo,bar}; +for (int i = 0; i 10; i++) { +conn.createStatement().execute(UPSERT INTO t VALUES( + (i % 4) + , + (i+100) + , + (i 5 ? 2 : 1) + ,' + s1Values[i%2] + ','bas')); +} +conn.commit(); + +rs = conn.createStatement().executeQuery(SELECT count(*) FROM v); +assertTrue(rs.next()); +assertEquals(5, rs.getLong(1)); +assertFalse(rs.next()); + +conn.createStatement().execute(CREATE INDEX vi1 on v(k2)); + +String query = SELECT k2 FROM v WHERE k2 IN (100,109) AND k3 IN (1,2) AND s2='bas'; +rs = conn.createStatement().executeQuery(query); +assertTrue(rs.next()); +assertEquals(100, rs.getInt(1)); +assertFalse(rs.next()); +rs = conn.createStatement().executeQuery(EXPLAIN + query); +String queryPlan = QueryUtil.getExplainPlan(rs); +assertEquals( +CLIENT PARALLEL 1-WAY SKIP SCAN ON 4 KEYS OVER I1 [1,100] - [2,109]\n + +SERVER FILTER BY (S2 = 'bas' AND S1 = 'foo'), queryPlan); +} } http://git-wip-us.apache.org/repos/asf/phoenix/blob/bdb724d3/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/DropIndexDuringUpsertIT.java -- diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/DropIndexDuringUpsertIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/DropIndexDuringUpsertIT.java index 4e44ec8..517630e 100644
phoenix git commit: PHOENIX-1480 Incorrect query results may occur when VIEW uses indexes from physical table
Repository: phoenix Updated Branches: refs/heads/4.0 db06f21df - bd2579542 PHOENIX-1480 Incorrect query results may occur when VIEW uses indexes from physical table Conflicts: phoenix-core/src/main/java/org/apache/phoenix/compile/WhereCompiler.java phoenix-core/src/main/java/org/apache/phoenix/schema/ColumnRef.java phoenix-core/src/main/java/org/apache/phoenix/util/IndexUtil.java Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/bd257954 Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/bd257954 Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/bd257954 Branch: refs/heads/4.0 Commit: bd2579542e33dc37e775ca7ecd75bfc9f440af2a Parents: db06f21 Author: James Taylor jtay...@salesforce.com Authored: Tue Dec 2 09:22:47 2014 -0800 Committer: James Taylor jtay...@salesforce.com Committed: Tue Dec 2 09:33:19 2014 -0800 -- .../java/org/apache/phoenix/end2end/ViewIT.java | 37 +++ .../end2end/index/DropIndexDuringUpsertIT.java | 2 + .../phoenix/compile/CreateTableCompiler.java| 13 +- .../apache/phoenix/compile/FromCompiler.java| 14 +- .../phoenix/compile/IndexStatementRewriter.java | 1 + .../phoenix/compile/StatementContext.java | 4 ++ .../apache/phoenix/compile/WhereCompiler.java | 5 +++ .../apache/phoenix/compile/WhereOptimizer.java | 2 +- .../org/apache/phoenix/schema/ColumnRef.java| 30 ++--- .../apache/phoenix/schema/MetaDataClient.java | 47 +--- .../org/apache/phoenix/schema/PTableImpl.java | 10 +++-- .../org/apache/phoenix/schema/TableRef.java | 33 +- .../java/org/apache/phoenix/util/IndexUtil.java | 41 - .../java/org/apache/phoenix/util/QueryUtil.java | 14 ++ .../phoenix/compile/QueryOptimizerTest.java | 38 +++- 15 files changed, 239 insertions(+), 52 deletions(-) -- http://git-wip-us.apache.org/repos/asf/phoenix/blob/bd257954/phoenix-core/src/it/java/org/apache/phoenix/end2end/ViewIT.java -- diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/ViewIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ViewIT.java index bc6f20d..0b06e03 100644 --- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/ViewIT.java +++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ViewIT.java @@ -34,6 +34,7 @@ import org.apache.phoenix.exception.SQLExceptionCode; import org.apache.phoenix.query.KeyRange; import org.apache.phoenix.schema.ReadOnlyTableException; import org.apache.phoenix.schema.TableNotFoundException; +import org.apache.phoenix.util.QueryUtil; import org.junit.Test; @@ -362,4 +363,40 @@ public class ViewIT extends BaseViewIT { //Expected } } + + @Test +public void testViewUsesTableIndex() throws Exception { +ResultSet rs; +Connection conn = DriverManager.getConnection(getUrl()); +String ddl = CREATE TABLE t (k1 INTEGER NOT NULL, k2 INTEGER NOT NULL, k3 DECIMAL, s1 VARCHAR, s2 VARCHAR CONSTRAINT pk PRIMARY KEY (k1, k2, k3)); +conn.createStatement().execute(ddl); +conn.createStatement().execute(CREATE INDEX i1 ON t(k3, k2) INCLUDE(s1, s2)); +conn.createStatement().execute(CREATE INDEX i2 ON t(k3, k2, s2)); + +ddl = CREATE VIEW v AS SELECT * FROM t WHERE s1 = 'foo'; +conn.createStatement().execute(ddl); +String[] s1Values = {foo,bar}; +for (int i = 0; i 10; i++) { +conn.createStatement().execute(UPSERT INTO t VALUES( + (i % 4) + , + (i+100) + , + (i 5 ? 2 : 1) + ,' + s1Values[i%2] + ','bas')); +} +conn.commit(); + +rs = conn.createStatement().executeQuery(SELECT count(*) FROM v); +assertTrue(rs.next()); +assertEquals(5, rs.getLong(1)); +assertFalse(rs.next()); + +conn.createStatement().execute(CREATE INDEX vi1 on v(k2)); + +String query = SELECT k2 FROM v WHERE k2 IN (100,109) AND k3 IN (1,2) AND s2='bas'; +rs = conn.createStatement().executeQuery(query); +assertTrue(rs.next()); +assertEquals(100, rs.getInt(1)); +assertFalse(rs.next()); +rs = conn.createStatement().executeQuery(EXPLAIN + query); +String queryPlan = QueryUtil.getExplainPlan(rs); +assertEquals( +CLIENT PARALLEL 1-WAY SKIP SCAN ON 4 KEYS OVER I1 [1,100] - [2,109]\n + +SERVER FILTER BY (S2 = 'bas' AND S1 = 'foo'), queryPlan); +} } http://git-wip-us.apache.org/repos/asf/phoenix/blob/bd257954/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/DropIndexDuringUpsertIT.java
phoenix git commit: PHOENIX-1480 Incorrect query results may occur when VIEW uses indexes from physical table
Repository: phoenix Updated Branches: refs/heads/master a18086025 - 766eec2b5 PHOENIX-1480 Incorrect query results may occur when VIEW uses indexes from physical table Conflicts: phoenix-core/src/main/java/org/apache/phoenix/compile/WhereCompiler.java phoenix-core/src/main/java/org/apache/phoenix/schema/ColumnRef.java phoenix-core/src/main/java/org/apache/phoenix/util/IndexUtil.java Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/766eec2b Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/766eec2b Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/766eec2b Branch: refs/heads/master Commit: 766eec2b502410387e90a598649e88064e8c84d8 Parents: a180860 Author: James Taylor jtay...@salesforce.com Authored: Tue Dec 2 09:22:47 2014 -0800 Committer: James Taylor jtay...@salesforce.com Committed: Tue Dec 2 09:34:43 2014 -0800 -- .../java/org/apache/phoenix/end2end/ViewIT.java | 37 +++ .../end2end/index/DropIndexDuringUpsertIT.java | 2 + .../phoenix/compile/CreateTableCompiler.java| 13 +- .../apache/phoenix/compile/FromCompiler.java| 14 +- .../phoenix/compile/IndexStatementRewriter.java | 1 + .../phoenix/compile/StatementContext.java | 4 ++ .../apache/phoenix/compile/WhereCompiler.java | 5 +++ .../apache/phoenix/compile/WhereOptimizer.java | 2 +- .../org/apache/phoenix/schema/ColumnRef.java| 30 ++--- .../apache/phoenix/schema/MetaDataClient.java | 47 +--- .../org/apache/phoenix/schema/PTableImpl.java | 10 +++-- .../org/apache/phoenix/schema/TableRef.java | 33 +- .../java/org/apache/phoenix/util/IndexUtil.java | 40 + .../java/org/apache/phoenix/util/QueryUtil.java | 14 ++ .../phoenix/compile/QueryOptimizerTest.java | 38 +++- 15 files changed, 239 insertions(+), 51 deletions(-) -- http://git-wip-us.apache.org/repos/asf/phoenix/blob/766eec2b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ViewIT.java -- diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/ViewIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ViewIT.java index bc6f20d..0b06e03 100644 --- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/ViewIT.java +++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ViewIT.java @@ -34,6 +34,7 @@ import org.apache.phoenix.exception.SQLExceptionCode; import org.apache.phoenix.query.KeyRange; import org.apache.phoenix.schema.ReadOnlyTableException; import org.apache.phoenix.schema.TableNotFoundException; +import org.apache.phoenix.util.QueryUtil; import org.junit.Test; @@ -362,4 +363,40 @@ public class ViewIT extends BaseViewIT { //Expected } } + + @Test +public void testViewUsesTableIndex() throws Exception { +ResultSet rs; +Connection conn = DriverManager.getConnection(getUrl()); +String ddl = CREATE TABLE t (k1 INTEGER NOT NULL, k2 INTEGER NOT NULL, k3 DECIMAL, s1 VARCHAR, s2 VARCHAR CONSTRAINT pk PRIMARY KEY (k1, k2, k3)); +conn.createStatement().execute(ddl); +conn.createStatement().execute(CREATE INDEX i1 ON t(k3, k2) INCLUDE(s1, s2)); +conn.createStatement().execute(CREATE INDEX i2 ON t(k3, k2, s2)); + +ddl = CREATE VIEW v AS SELECT * FROM t WHERE s1 = 'foo'; +conn.createStatement().execute(ddl); +String[] s1Values = {foo,bar}; +for (int i = 0; i 10; i++) { +conn.createStatement().execute(UPSERT INTO t VALUES( + (i % 4) + , + (i+100) + , + (i 5 ? 2 : 1) + ,' + s1Values[i%2] + ','bas')); +} +conn.commit(); + +rs = conn.createStatement().executeQuery(SELECT count(*) FROM v); +assertTrue(rs.next()); +assertEquals(5, rs.getLong(1)); +assertFalse(rs.next()); + +conn.createStatement().execute(CREATE INDEX vi1 on v(k2)); + +String query = SELECT k2 FROM v WHERE k2 IN (100,109) AND k3 IN (1,2) AND s2='bas'; +rs = conn.createStatement().executeQuery(query); +assertTrue(rs.next()); +assertEquals(100, rs.getInt(1)); +assertFalse(rs.next()); +rs = conn.createStatement().executeQuery(EXPLAIN + query); +String queryPlan = QueryUtil.getExplainPlan(rs); +assertEquals( +CLIENT PARALLEL 1-WAY SKIP SCAN ON 4 KEYS OVER I1 [1,100] - [2,109]\n + +SERVER FILTER BY (S2 = 'bas' AND S1 = 'foo'), queryPlan); +} } http://git-wip-us.apache.org/repos/asf/phoenix/blob/766eec2b/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/DropIndexDuringUpsertIT.java
phoenix git commit: PHOENIX-1480 Incorrect query results may occur when VIEW uses indexes from physical table
Repository: phoenix Updated Branches: refs/heads/3.2 a424affdd - 44bd4bec1 PHOENIX-1480 Incorrect query results may occur when VIEW uses indexes from physical table Conflicts: phoenix-core/src/it/java/org/apache/phoenix/end2end/index/DropIndexDuringUpsertIT.java phoenix-core/src/main/java/org/apache/phoenix/compile/IndexStatementRewriter.java phoenix-core/src/main/java/org/apache/phoenix/compile/WhereCompiler.java phoenix-core/src/main/java/org/apache/phoenix/schema/ColumnRef.java phoenix-core/src/main/java/org/apache/phoenix/schema/PTableImpl.java phoenix-core/src/main/java/org/apache/phoenix/util/IndexUtil.java phoenix-core/src/main/java/org/apache/phoenix/util/QueryUtil.java Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/44bd4bec Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/44bd4bec Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/44bd4bec Branch: refs/heads/3.2 Commit: 44bd4bec1189d1346c2a4a9add31a8ecbe3945d2 Parents: a424aff Author: James Taylor jtay...@salesforce.com Authored: Tue Dec 2 09:22:47 2014 -0800 Committer: James Taylor jtay...@salesforce.com Committed: Tue Dec 2 09:49:07 2014 -0800 -- .../java/org/apache/phoenix/end2end/ViewIT.java | 37 +++ .../phoenix/compile/CreateTableCompiler.java| 13 +- .../apache/phoenix/compile/FromCompiler.java| 14 +- .../phoenix/compile/IndexStatementRewriter.java | 1 + .../phoenix/compile/StatementContext.java | 4 ++ .../apache/phoenix/compile/WhereCompiler.java | 5 +++ .../apache/phoenix/compile/WhereOptimizer.java | 2 +- .../org/apache/phoenix/schema/ColumnRef.java| 25 ++- .../apache/phoenix/schema/MetaDataClient.java | 47 +--- .../org/apache/phoenix/schema/PTableImpl.java | 10 +++-- .../org/apache/phoenix/schema/TableRef.java | 33 +- .../java/org/apache/phoenix/util/IndexUtil.java | 42 + .../java/org/apache/phoenix/util/QueryUtil.java | 14 ++ .../phoenix/compile/QueryOptimizerTest.java | 38 +++- 14 files changed, 239 insertions(+), 46 deletions(-) -- http://git-wip-us.apache.org/repos/asf/phoenix/blob/44bd4bec/phoenix-core/src/it/java/org/apache/phoenix/end2end/ViewIT.java -- diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/ViewIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ViewIT.java index 1b89b8d..0ff8faf 100644 --- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/ViewIT.java +++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ViewIT.java @@ -34,6 +34,7 @@ import org.apache.phoenix.exception.SQLExceptionCode; import org.apache.phoenix.query.KeyRange; import org.apache.phoenix.schema.ReadOnlyTableException; import org.apache.phoenix.schema.TableNotFoundException; +import org.apache.phoenix.util.QueryUtil; import org.junit.Test; @@ -362,4 +363,40 @@ public class ViewIT extends BaseViewIT { //Expected } } + + @Test +public void testViewUsesTableIndex() throws Exception { +ResultSet rs; +Connection conn = DriverManager.getConnection(getUrl()); +String ddl = CREATE TABLE t (k1 INTEGER NOT NULL, k2 INTEGER NOT NULL, k3 DECIMAL, s1 VARCHAR, s2 VARCHAR CONSTRAINT pk PRIMARY KEY (k1, k2, k3)); +conn.createStatement().execute(ddl); +conn.createStatement().execute(CREATE INDEX i1 ON t(k3, k2) INCLUDE(s1, s2)); +conn.createStatement().execute(CREATE INDEX i2 ON t(k3, k2, s2)); + +ddl = CREATE VIEW v AS SELECT * FROM t WHERE s1 = 'foo'; +conn.createStatement().execute(ddl); +String[] s1Values = {foo,bar}; +for (int i = 0; i 10; i++) { +conn.createStatement().execute(UPSERT INTO t VALUES( + (i % 4) + , + (i+100) + , + (i 5 ? 2 : 1) + ,' + s1Values[i%2] + ','bas')); +} +conn.commit(); + +rs = conn.createStatement().executeQuery(SELECT count(*) FROM v); +assertTrue(rs.next()); +assertEquals(5, rs.getLong(1)); +assertFalse(rs.next()); + +conn.createStatement().execute(CREATE INDEX vi1 on v(k2)); + +String query = SELECT k2 FROM v WHERE k2 IN (100,109) AND k3 IN (1,2) AND s2='bas'; +rs = conn.createStatement().executeQuery(query); +assertTrue(rs.next()); +assertEquals(100, rs.getInt(1)); +assertFalse(rs.next()); +rs = conn.createStatement().executeQuery(EXPLAIN + query); +String queryPlan = QueryUtil.getExplainPlan(rs); +assertEquals( +CLIENT PARALLEL 1-WAY SKIP SCAN ON 4 KEYS OVER I1 [1,100] - [2,109]\n + +
Apache-Phoenix | Master | Build Successful
Master branch build status Successful Source repository https://git-wip-us.apache.org/repos/asf/phoenix.git Last Successful Compiled Artifacts https://builds.apache.org/job/Phoenix-master/lastSuccessfulBuild/artifact/ Last Complete Test Report https://builds.apache.org/job/Phoenix-master/lastCompletedBuild/testReport/ Changes [jtaylor] PHOENIX-1480 Incorrect query results may occur when VIEW uses indexes from physical table
phoenix git commit: PHOENIX-1480 Incorrect query results may occur when VIEW uses indexes from physical table
Repository: phoenix Updated Branches: refs/heads/3.0 4f9a71d79 - 9313d1052 PHOENIX-1480 Incorrect query results may occur when VIEW uses indexes from physical table Conflicts: phoenix-core/src/it/java/org/apache/phoenix/end2end/index/DropIndexDuringUpsertIT.java phoenix-core/src/main/java/org/apache/phoenix/compile/IndexStatementRewriter.java phoenix-core/src/main/java/org/apache/phoenix/compile/WhereCompiler.java phoenix-core/src/main/java/org/apache/phoenix/schema/ColumnRef.java phoenix-core/src/main/java/org/apache/phoenix/schema/PTableImpl.java phoenix-core/src/main/java/org/apache/phoenix/util/IndexUtil.java phoenix-core/src/main/java/org/apache/phoenix/util/QueryUtil.java Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/9313d105 Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/9313d105 Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/9313d105 Branch: refs/heads/3.0 Commit: 9313d1052f9b5bfee43343305d3eba7aaeb16a15 Parents: 4f9a71d Author: James Taylor jtay...@salesforce.com Authored: Tue Dec 2 09:22:47 2014 -0800 Committer: James Taylor jtay...@salesforce.com Committed: Tue Dec 2 10:00:49 2014 -0800 -- .../java/org/apache/phoenix/end2end/ViewIT.java | 37 +++ .../phoenix/compile/CreateTableCompiler.java| 13 +- .../apache/phoenix/compile/FromCompiler.java| 14 +- .../phoenix/compile/IndexStatementRewriter.java | 1 + .../phoenix/compile/StatementContext.java | 4 ++ .../apache/phoenix/compile/WhereCompiler.java | 5 +++ .../apache/phoenix/compile/WhereOptimizer.java | 2 +- .../org/apache/phoenix/schema/ColumnRef.java| 25 ++- .../apache/phoenix/schema/MetaDataClient.java | 47 +--- .../org/apache/phoenix/schema/PTableImpl.java | 10 +++-- .../org/apache/phoenix/schema/TableRef.java | 33 +- .../java/org/apache/phoenix/util/IndexUtil.java | 42 + .../java/org/apache/phoenix/util/QueryUtil.java | 14 ++ .../phoenix/compile/QueryOptimizerTest.java | 38 +++- 14 files changed, 239 insertions(+), 46 deletions(-) -- http://git-wip-us.apache.org/repos/asf/phoenix/blob/9313d105/phoenix-core/src/it/java/org/apache/phoenix/end2end/ViewIT.java -- diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/ViewIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ViewIT.java index 1b89b8d..0ff8faf 100644 --- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/ViewIT.java +++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ViewIT.java @@ -34,6 +34,7 @@ import org.apache.phoenix.exception.SQLExceptionCode; import org.apache.phoenix.query.KeyRange; import org.apache.phoenix.schema.ReadOnlyTableException; import org.apache.phoenix.schema.TableNotFoundException; +import org.apache.phoenix.util.QueryUtil; import org.junit.Test; @@ -362,4 +363,40 @@ public class ViewIT extends BaseViewIT { //Expected } } + + @Test +public void testViewUsesTableIndex() throws Exception { +ResultSet rs; +Connection conn = DriverManager.getConnection(getUrl()); +String ddl = CREATE TABLE t (k1 INTEGER NOT NULL, k2 INTEGER NOT NULL, k3 DECIMAL, s1 VARCHAR, s2 VARCHAR CONSTRAINT pk PRIMARY KEY (k1, k2, k3)); +conn.createStatement().execute(ddl); +conn.createStatement().execute(CREATE INDEX i1 ON t(k3, k2) INCLUDE(s1, s2)); +conn.createStatement().execute(CREATE INDEX i2 ON t(k3, k2, s2)); + +ddl = CREATE VIEW v AS SELECT * FROM t WHERE s1 = 'foo'; +conn.createStatement().execute(ddl); +String[] s1Values = {foo,bar}; +for (int i = 0; i 10; i++) { +conn.createStatement().execute(UPSERT INTO t VALUES( + (i % 4) + , + (i+100) + , + (i 5 ? 2 : 1) + ,' + s1Values[i%2] + ','bas')); +} +conn.commit(); + +rs = conn.createStatement().executeQuery(SELECT count(*) FROM v); +assertTrue(rs.next()); +assertEquals(5, rs.getLong(1)); +assertFalse(rs.next()); + +conn.createStatement().execute(CREATE INDEX vi1 on v(k2)); + +String query = SELECT k2 FROM v WHERE k2 IN (100,109) AND k3 IN (1,2) AND s2='bas'; +rs = conn.createStatement().executeQuery(query); +assertTrue(rs.next()); +assertEquals(100, rs.getInt(1)); +assertFalse(rs.next()); +rs = conn.createStatement().executeQuery(EXPLAIN + query); +String queryPlan = QueryUtil.getExplainPlan(rs); +assertEquals( +CLIENT PARALLEL 1-WAY SKIP SCAN ON 4 KEYS OVER I1 [1,100] - [2,109]\n + +
Apache-Phoenix | 4.0 | Build Successful
4.0 branch build status Successful Source repository https://git-wip-us.apache.org/repos/asf/incubator-phoenix.git Compiled Artifacts https://builds.apache.org/job/Phoenix-4.0/lastSuccessfulBuild/artifact/ Test Report https://builds.apache.org/job/Phoenix-4.0/lastCompletedBuild/testReport/ Changes [jtaylor] PHOENIX-1480 Incorrect query results may occur when VIEW uses indexes from physical table
[2/3] phoenix git commit: PHOENIX-1496 Further reduce work in StatsCollector.
PHOENIX-1496 Further reduce work in StatsCollector. Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/f57eac18 Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/f57eac18 Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/f57eac18 Branch: refs/heads/4.0 Commit: f57eac18e0e2314141c0f91e8ed512751bf18da3 Parents: bd25795 Author: Lars Hofhansl la...@apache.org Authored: Tue Dec 2 10:03:01 2014 -0800 Committer: Lars Hofhansl la...@apache.org Committed: Tue Dec 2 10:03:22 2014 -0800 -- .../UngroupedAggregateRegionObserver.java | 4 ++- .../schema/stats/StatisticsCollector.java | 38 ++-- .../phoenix/schema/stats/StatisticsScanner.java | 1 - 3 files changed, 30 insertions(+), 13 deletions(-) -- http://git-wip-us.apache.org/repos/asf/phoenix/blob/f57eac18/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/UngroupedAggregateRegionObserver.java -- diff --git a/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/UngroupedAggregateRegionObserver.java b/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/UngroupedAggregateRegionObserver.java index e0ff5b3..ff05dad 100644 --- a/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/UngroupedAggregateRegionObserver.java +++ b/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/UngroupedAggregateRegionObserver.java @@ -466,7 +466,9 @@ public class UngroupedAggregateRegionObserver extends BaseScannerRegionObserver{ // when background tasks are updating stats. Instead we track the max timestamp of // the cells and use that. long clientTimeStamp = useCurrentTime ? TimeKeeper.SYSTEM.getCurrentTime() : StatisticsCollector.NO_TIMESTAMP; -StatisticsCollector stats = new StatisticsCollector(c.getEnvironment(), table.getNameAsString(), clientTimeStamp); +StatisticsCollector stats = new StatisticsCollector( +c.getEnvironment(), table.getNameAsString(), +clientTimeStamp, store.getFamily().getName()); internalScanner = stats.createCompactionScanner(c.getEnvironment().getRegion(), store, scanner); } catch (IOException e) { // If we can't reach the stats table, don't interrupt the normal http://git-wip-us.apache.org/repos/asf/phoenix/blob/f57eac18/phoenix-core/src/main/java/org/apache/phoenix/schema/stats/StatisticsCollector.java -- diff --git a/phoenix-core/src/main/java/org/apache/phoenix/schema/stats/StatisticsCollector.java b/phoenix-core/src/main/java/org/apache/phoenix/schema/stats/StatisticsCollector.java index 4123ebe..b943b97 100644 --- a/phoenix-core/src/main/java/org/apache/phoenix/schema/stats/StatisticsCollector.java +++ b/phoenix-core/src/main/java/org/apache/phoenix/schema/stats/StatisticsCollector.java @@ -65,8 +65,13 @@ public class StatisticsCollector { // Tracks the bytecount per family if it has reached the guidePostsDepth private MapImmutableBytesPtr, Boolean familyMap = Maps.newHashMap(); protected StatisticsWriter statsTable; +private PairLong,GuidePostsInfo cachedGps = null; public StatisticsCollector(RegionCoprocessorEnvironment env, String tableName, long clientTimeStamp) throws IOException { +this(env, tableName, clientTimeStamp, null); +} + +public StatisticsCollector(RegionCoprocessorEnvironment env, String tableName, long clientTimeStamp, byte[] family) throws IOException { Configuration config = env.getConfiguration(); int guidepostPerRegion = config.getInt(QueryServices.STATS_GUIDEPOST_PER_REGION_ATTRIB, QueryServicesOptions.DEFAULT_STATS_GUIDEPOST_PER_REGION); @@ -76,6 +81,13 @@ public class StatisticsCollector { // Get the stats table associated with the current table on which the CP is // triggered this.statsTable = StatisticsWriter.newWriter(env, tableName, clientTimeStamp); +// in a compaction we know the one family ahead of time +if (family != null) { +ImmutableBytesPtr cfKey = new ImmutableBytesPtr(family); +familyMap.put(cfKey, true); +cachedGps = new PairLong,GuidePostsInfo(0L,new GuidePostsInfo(0, Collections.byte[]emptyList())); +guidePostsMap.put(cfKey, cachedGps); +} } public long getMaxTimeStamp() { @@ -147,8 +159,7 @@ public class StatisticsCollector { if (logger.isDebugEnabled()) { logger.debug(Compaction scanner created for stats); } -// FIXME: no way to get cf as byte[] ? -
[1/3] phoenix git commit: PHOENIX-1496 Further reduce work in StatsCollector.
Repository: phoenix Updated Branches: refs/heads/3.0 9313d1052 - 6cec3465b refs/heads/4.0 bd2579542 - f57eac18e refs/heads/master 766eec2b5 - d6ba63570 PHOENIX-1496 Further reduce work in StatsCollector. Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/d6ba6357 Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/d6ba6357 Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/d6ba6357 Branch: refs/heads/master Commit: d6ba63570975a276c2ba09fb7f99fdce096bd7b9 Parents: 766eec2 Author: Lars Hofhansl la...@apache.org Authored: Tue Dec 2 10:03:01 2014 -0800 Committer: Lars Hofhansl la...@apache.org Committed: Tue Dec 2 10:03:01 2014 -0800 -- .../UngroupedAggregateRegionObserver.java | 4 ++- .../schema/stats/StatisticsCollector.java | 38 ++-- .../phoenix/schema/stats/StatisticsScanner.java | 1 - 3 files changed, 30 insertions(+), 13 deletions(-) -- http://git-wip-us.apache.org/repos/asf/phoenix/blob/d6ba6357/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/UngroupedAggregateRegionObserver.java -- diff --git a/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/UngroupedAggregateRegionObserver.java b/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/UngroupedAggregateRegionObserver.java index e0ff5b3..ff05dad 100644 --- a/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/UngroupedAggregateRegionObserver.java +++ b/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/UngroupedAggregateRegionObserver.java @@ -466,7 +466,9 @@ public class UngroupedAggregateRegionObserver extends BaseScannerRegionObserver{ // when background tasks are updating stats. Instead we track the max timestamp of // the cells and use that. long clientTimeStamp = useCurrentTime ? TimeKeeper.SYSTEM.getCurrentTime() : StatisticsCollector.NO_TIMESTAMP; -StatisticsCollector stats = new StatisticsCollector(c.getEnvironment(), table.getNameAsString(), clientTimeStamp); +StatisticsCollector stats = new StatisticsCollector( +c.getEnvironment(), table.getNameAsString(), +clientTimeStamp, store.getFamily().getName()); internalScanner = stats.createCompactionScanner(c.getEnvironment().getRegion(), store, scanner); } catch (IOException e) { // If we can't reach the stats table, don't interrupt the normal http://git-wip-us.apache.org/repos/asf/phoenix/blob/d6ba6357/phoenix-core/src/main/java/org/apache/phoenix/schema/stats/StatisticsCollector.java -- diff --git a/phoenix-core/src/main/java/org/apache/phoenix/schema/stats/StatisticsCollector.java b/phoenix-core/src/main/java/org/apache/phoenix/schema/stats/StatisticsCollector.java index 4123ebe..b943b97 100644 --- a/phoenix-core/src/main/java/org/apache/phoenix/schema/stats/StatisticsCollector.java +++ b/phoenix-core/src/main/java/org/apache/phoenix/schema/stats/StatisticsCollector.java @@ -65,8 +65,13 @@ public class StatisticsCollector { // Tracks the bytecount per family if it has reached the guidePostsDepth private MapImmutableBytesPtr, Boolean familyMap = Maps.newHashMap(); protected StatisticsWriter statsTable; +private PairLong,GuidePostsInfo cachedGps = null; public StatisticsCollector(RegionCoprocessorEnvironment env, String tableName, long clientTimeStamp) throws IOException { +this(env, tableName, clientTimeStamp, null); +} + +public StatisticsCollector(RegionCoprocessorEnvironment env, String tableName, long clientTimeStamp, byte[] family) throws IOException { Configuration config = env.getConfiguration(); int guidepostPerRegion = config.getInt(QueryServices.STATS_GUIDEPOST_PER_REGION_ATTRIB, QueryServicesOptions.DEFAULT_STATS_GUIDEPOST_PER_REGION); @@ -76,6 +81,13 @@ public class StatisticsCollector { // Get the stats table associated with the current table on which the CP is // triggered this.statsTable = StatisticsWriter.newWriter(env, tableName, clientTimeStamp); +// in a compaction we know the one family ahead of time +if (family != null) { +ImmutableBytesPtr cfKey = new ImmutableBytesPtr(family); +familyMap.put(cfKey, true); +cachedGps = new PairLong,GuidePostsInfo(0L,new GuidePostsInfo(0, Collections.byte[]emptyList())); +guidePostsMap.put(cfKey, cachedGps); +} } public long getMaxTimeStamp() { @@ -147,8 +159,7 @@ public class StatisticsCollector { if
Apache-Phoenix | 4.0 | Build Successful
4.0 branch build status Successful Source repository https://git-wip-us.apache.org/repos/asf/incubator-phoenix.git Compiled Artifacts https://builds.apache.org/job/Phoenix-4.0/lastSuccessfulBuild/artifact/ Test Report https://builds.apache.org/job/Phoenix-4.0/lastCompletedBuild/testReport/ Changes [larsh] PHOENIX-1496 Further reduce work in StatsCollector.
phoenix git commit: PHOENIX-1477: Phoenix 4.0 - 4.2 upgrade doesn't work
Repository: phoenix Updated Branches: refs/heads/4.0 f57eac18e - 429acbab7 PHOENIX-1477: Phoenix 4.0 - 4.2 upgrade doesn't work Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/429acbab Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/429acbab Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/429acbab Branch: refs/heads/4.0 Commit: 429acbab7d2e2aabb99a6b50d1bc113462009acc Parents: f57eac1 Author: Jeffrey Zhong jeffr...@apache.org Authored: Tue Dec 2 13:42:26 2014 -0800 Committer: Jeffrey Zhong jeffr...@apache.org Committed: Tue Dec 2 13:42:26 2014 -0800 -- .../org/apache/phoenix/query/ConnectionQueryServicesImpl.java | 7 +++ 1 file changed, 7 insertions(+) -- http://git-wip-us.apache.org/repos/asf/phoenix/blob/429acbab/phoenix-core/src/main/java/org/apache/phoenix/query/ConnectionQueryServicesImpl.java -- diff --git a/phoenix-core/src/main/java/org/apache/phoenix/query/ConnectionQueryServicesImpl.java b/phoenix-core/src/main/java/org/apache/phoenix/query/ConnectionQueryServicesImpl.java index 299b367..d443c53 100644 --- a/phoenix-core/src/main/java/org/apache/phoenix/query/ConnectionQueryServicesImpl.java +++ b/phoenix-core/src/main/java/org/apache/phoenix/query/ConnectionQueryServicesImpl.java @@ -1678,6 +1678,13 @@ public class ConnectionQueryServicesImpl extends DelegateQueryServices implement // Ignore, as this will happen if the SYSTEM.CATALOG already exists at this fixed timestamp. // A TableAlreadyExistsException is not thrown, since the table only exists *after* this fixed timestamp. } catch (TableAlreadyExistsException ignore) { +// This will occur if we have an older SYSTEM.CATALOG and we need to update it to include +// any new columns we've added. +metaConnection = addColumnsIfNotExists(metaConnection, + PhoenixDatabaseMetaData.SYSTEM_CATALOG, + MetaDataProtocol.MIN_SYSTEM_TABLE_TIMESTAMP, + PhoenixDatabaseMetaData.INDEX_TYPE + + PDataType.UNSIGNED_TINYINT.getSqlTypeName() + + , + PhoenixDatabaseMetaData.INDEX_DISABLE_TIMESTAMP + + PDataType.LONG.getSqlTypeName()); } int nSaltBuckets = ConnectionQueryServicesImpl.this.props.getInt(QueryServices.SEQUENCE_SALT_BUCKETS_ATTRIB, QueryServicesOptions.DEFAULT_SEQUENCE_TABLE_SALT_BUCKETS);
phoenix git commit: PHOENIX-1477: Phoenix 4.0 - 4.2 upgrade doesn't work
Repository: phoenix Updated Branches: refs/heads/4.2 bdb724d34 - 5580da441 PHOENIX-1477: Phoenix 4.0 - 4.2 upgrade doesn't work Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/5580da44 Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/5580da44 Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/5580da44 Branch: refs/heads/4.2 Commit: 5580da441f3b8cb568df694ced104c247698c618 Parents: bdb724d Author: Jeffrey Zhong jeffr...@apache.org Authored: Tue Dec 2 13:42:26 2014 -0800 Committer: Jeffrey Zhong jeffr...@apache.org Committed: Tue Dec 2 13:46:42 2014 -0800 -- .../org/apache/phoenix/query/ConnectionQueryServicesImpl.java | 7 +++ 1 file changed, 7 insertions(+) -- http://git-wip-us.apache.org/repos/asf/phoenix/blob/5580da44/phoenix-core/src/main/java/org/apache/phoenix/query/ConnectionQueryServicesImpl.java -- diff --git a/phoenix-core/src/main/java/org/apache/phoenix/query/ConnectionQueryServicesImpl.java b/phoenix-core/src/main/java/org/apache/phoenix/query/ConnectionQueryServicesImpl.java index 8bd99b3..63fa07a 100644 --- a/phoenix-core/src/main/java/org/apache/phoenix/query/ConnectionQueryServicesImpl.java +++ b/phoenix-core/src/main/java/org/apache/phoenix/query/ConnectionQueryServicesImpl.java @@ -1553,6 +1553,13 @@ public class ConnectionQueryServicesImpl extends DelegateQueryServices implement // Ignore, as this will happen if the SYSTEM.CATALOG already exists at this fixed timestamp. // A TableAlreadyExistsException is not thrown, since the table only exists *after* this fixed timestamp. } catch (TableAlreadyExistsException ignore) { +// This will occur if we have an older SYSTEM.CATALOG and we need to update it to include +// any new columns we've added. +metaConnection = addColumnsIfNotExists(metaConnection, + PhoenixDatabaseMetaData.SYSTEM_CATALOG, + MetaDataProtocol.MIN_SYSTEM_TABLE_TIMESTAMP, + PhoenixDatabaseMetaData.INDEX_TYPE + + PDataType.UNSIGNED_TINYINT.getSqlTypeName() + + , + PhoenixDatabaseMetaData.INDEX_DISABLE_TIMESTAMP + + PDataType.LONG.getSqlTypeName()); } int nSaltBuckets = ConnectionQueryServicesImpl.this.props.getInt(QueryServices.SEQUENCE_SALT_BUCKETS_ATTRIB, QueryServicesOptions.DEFAULT_SEQUENCE_TABLE_SALT_BUCKETS);
[1/2] phoenix git commit: Sync changes from https://github.com/julianhyde/phoenix/tree/calcite
Repository: phoenix Updated Branches: refs/heads/calcite 766eec2b5 - b005b1246 Sync changes from https://github.com/julianhyde/phoenix/tree/calcite Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/76a858a4 Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/76a858a4 Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/76a858a4 Branch: refs/heads/calcite Commit: 76a858a411b0a497037f1c5384a4cd9ca838a991 Parents: 766eec2 Author: maryannxue maryann...@apache.org Authored: Tue Dec 2 16:49:09 2014 -0500 Committer: maryannxue maryann...@apache.org Committed: Tue Dec 2 16:49:09 2014 -0500 -- .../org/apache/phoenix/calcite/CalciteTest.java | 226 + .../apache/phoenix/calcite/BuiltInMethod.java | 44 +++ .../apache/phoenix/calcite/CalciteRuntime.java | 79 + .../apache/phoenix/calcite/CalciteUtils.java| 90 + .../phoenix/calcite/PhoenixAggregate.java | 53 +++ .../apache/phoenix/calcite/PhoenixFilter.java | 40 +++ .../calcite/PhoenixFilterScanMergeRule.java | 36 ++ .../org/apache/phoenix/calcite/PhoenixJoin.java | 40 +++ .../apache/phoenix/calcite/PhoenixProject.java | 40 +++ .../org/apache/phoenix/calcite/PhoenixRel.java | 39 +++ .../calcite/PhoenixRelImplementorImpl.java | 91 + .../apache/phoenix/calcite/PhoenixRules.java| 334 +++ .../apache/phoenix/calcite/PhoenixSchema.java | 135 .../org/apache/phoenix/calcite/PhoenixSort.java | 32 ++ .../apache/phoenix/calcite/PhoenixTable.java| 77 + .../phoenix/calcite/PhoenixTableScan.java | 60 .../calcite/PhoenixToEnumerableConverter.java | 72 .../apache/phoenix/calcite/PhoenixUnion.java| 39 +++ .../apache/phoenix/calcite/PhoenixValues.java | 36 ++ .../phoenix/calcite/ToExpressionTest.java | 77 + 20 files changed, 1640 insertions(+) -- http://git-wip-us.apache.org/repos/asf/phoenix/blob/76a858a4/phoenix-core/src/it/java/org/apache/phoenix/calcite/CalciteTest.java -- diff --git a/phoenix-core/src/it/java/org/apache/phoenix/calcite/CalciteTest.java b/phoenix-core/src/it/java/org/apache/phoenix/calcite/CalciteTest.java new file mode 100644 index 000..9bce0a3 --- /dev/null +++ b/phoenix-core/src/it/java/org/apache/phoenix/calcite/CalciteTest.java @@ -0,0 +1,226 @@ +package org.apache.phoenix.calcite; + +import com.google.common.collect.Lists; +import org.apache.calcite.jdbc.CalciteConnection; +import org.apache.phoenix.end2end.BaseClientManagedTimeIT; +import org.apache.phoenix.jdbc.PhoenixConnection; +import org.apache.phoenix.query.BaseTest; +import org.junit.Ignore; +import org.junit.Test; + +import java.io.File; +import java.io.FileWriter; +import java.io.PrintWriter; +import java.sql.*; +import java.util.Arrays; +import java.util.List; + +import static org.hamcrest.CoreMatchers.equalTo; +import static org.junit.Assert.*; + +/** + * Integration test for queries powered by Calcite. + */ +public class CalciteTest extends BaseClientManagedTimeIT { +public static final String ATABLE_NAME = ATABLE; + +public static Start start() { +return new Start(); +} + +public static class Start { +private Connection connection; + +Connection createConnection() throws Exception { +return CalciteTest.createConnection(); +} + +public Sql sql(String sql) { +return new Sql(this, sql); +} + +public Connection getConnection() { +if (connection == null) { +try { +connection = createConnection(); +} catch (Exception e) { +throw new RuntimeException(e); +} +} +return connection; +} + +public void close() { +if (connection != null) { +try { +connection.close(); +} catch (SQLException e) { +throw new RuntimeException(e); +} +} +} +} + +/** Fluid class for a test that has specified a SQL query. */ +static class Sql { +private final Start start; +private final String sql; + +public Sql(Start start, String sql) { +this.start = start; +this.sql = sql; +} + +public ListString getResult(ResultSet resultSet) throws SQLException { +final ListString list = Lists.newArrayList(); +populateResult(resultSet, list); +return list; +} + +private void populateResult(ResultSet resultSet, ListString list) throws SQLException { +final StringBuilder buf = new StringBuilder(); +
[2/2] phoenix git commit: Sync changes from https://github.com/julianhyde/phoenix/tree/calcite
Sync changes from https://github.com/julianhyde/phoenix/tree/calcite Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/b005b124 Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/b005b124 Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/b005b124 Branch: refs/heads/calcite Commit: b005b1246841e677be6890583597531f0c8036c9 Parents: 76a858a Author: maryannxue maryann...@apache.org Authored: Tue Dec 2 16:50:32 2014 -0500 Committer: maryannxue maryann...@apache.org Committed: Tue Dec 2 16:50:32 2014 -0500 -- phoenix-core/pom.xml | 8 .../phoenix/calcite/PhoenixRelImplementorImpl.java | 6 +- .../java/org/apache/phoenix/compile/FromCompiler.java| 3 ++- .../java/org/apache/phoenix/compile/WhereCompiler.java | 2 +- .../java/org/apache/phoenix/parse/SelectStatement.java | 7 +++ pom.xml | 11 +++ 6 files changed, 34 insertions(+), 3 deletions(-) -- http://git-wip-us.apache.org/repos/asf/phoenix/blob/b005b124/phoenix-core/pom.xml -- diff --git a/phoenix-core/pom.xml b/phoenix-core/pom.xml index b98e9b2..70d54e7 100644 --- a/phoenix-core/pom.xml +++ b/phoenix-core/pom.xml @@ -319,6 +319,14 @@ artifactIdcommons-csv/artifactId /dependency dependency + groupIdorg.apache.calcite/groupId + artifactIdcalcite-avatica/artifactId +/dependency +dependency + groupIdorg.apache.calcite/groupId + artifactIdcalcite-core/artifactId +/dependency +dependency groupIdcom.google.code.findbugs/groupId artifactIdjsr305/artifactId /dependency http://git-wip-us.apache.org/repos/asf/phoenix/blob/b005b124/phoenix-core/src/main/java/org/apache/phoenix/calcite/PhoenixRelImplementorImpl.java -- diff --git a/phoenix-core/src/main/java/org/apache/phoenix/calcite/PhoenixRelImplementorImpl.java b/phoenix-core/src/main/java/org/apache/phoenix/calcite/PhoenixRelImplementorImpl.java index a7d62e2..a833b6b 100644 --- a/phoenix-core/src/main/java/org/apache/phoenix/calcite/PhoenixRelImplementorImpl.java +++ b/phoenix-core/src/main/java/org/apache/phoenix/calcite/PhoenixRelImplementorImpl.java @@ -82,10 +82,14 @@ class PhoenixRelImplementorImpl implements PhoenixRel.Implementor { @Override public QueryPlan makePlan() { +try { Integer limit = null; OrderBy orderBy = OrderBy.EMPTY_ORDER_BY; ParallelIteratorFactory iteratorFactory = null; -return new ScanPlan(context, select, tableRef, projector, limit, orderBy, iteratorFactory, true); +return new ScanPlan(context, select, tableRef, projector, limit, orderBy, iteratorFactory, true); +} catch (SQLException e) { +throw new RuntimeException(e); +} } } http://git-wip-us.apache.org/repos/asf/phoenix/blob/b005b124/phoenix-core/src/main/java/org/apache/phoenix/compile/FromCompiler.java -- diff --git a/phoenix-core/src/main/java/org/apache/phoenix/compile/FromCompiler.java b/phoenix-core/src/main/java/org/apache/phoenix/compile/FromCompiler.java index fb3183a..2c4a578 100644 --- a/phoenix-core/src/main/java/org/apache/phoenix/compile/FromCompiler.java +++ b/phoenix-core/src/main/java/org/apache/phoenix/compile/FromCompiler.java @@ -24,6 +24,7 @@ import java.util.Collections; import java.util.Iterator; import java.util.List; +import com.google.common.base.Preconditions; import org.apache.hadoop.hbase.HConstants; import org.apache.hadoop.hbase.client.HTableInterface; import org.apache.phoenix.coprocessor.MetaDataProtocol; @@ -317,7 +318,7 @@ public class FromCompiler { private final int tsAddition; private BaseColumnResolver(PhoenixConnection connection, int tsAddition) { - this.connection = connection; +this.connection = Preconditions.checkNotNull(connection); this.client = connection == null ? null : new MetaDataClient(connection); this.tsAddition = tsAddition; } http://git-wip-us.apache.org/repos/asf/phoenix/blob/b005b124/phoenix-core/src/main/java/org/apache/phoenix/compile/WhereCompiler.java -- diff --git a/phoenix-core/src/main/java/org/apache/phoenix/compile/WhereCompiler.java b/phoenix-core/src/main/java/org/apache/phoenix/compile/WhereCompiler.java index b3a9c2d..694eb6a 100644 --- a/phoenix-core/src/main/java/org/apache/phoenix/compile/WhereCompiler.java
Build failed in Jenkins: Phoenix | 4.2 #28
See https://builds.apache.org/job/Phoenix-4.2/28/changes Changes: [jeffreyz] PHOENIX-1477: Phoenix 4.0 - 4.2 upgrade doesn't work -- [...truncated 354 lines...] Tests run: 77, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 67.848 sec - in org.apache.phoenix.end2end.NotQueryIT Running org.apache.phoenix.end2end.IsNullIT Tests run: 2, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 6.033 sec - in org.apache.phoenix.end2end.IsNullIT Tests run: 12, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 44.953 sec - in org.apache.phoenix.end2end.UpsertSelectIT Running org.apache.phoenix.end2end.RowValueConstructorIT Running org.apache.phoenix.end2end.ArrayIT Tests run: 63, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 60.491 sec - in org.apache.phoenix.end2end.CaseStatementIT Running org.apache.phoenix.end2end.GroupByCaseIT Tests run: 3, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 3.248 sec - in org.apache.phoenix.end2end.GroupByCaseIT Running org.apache.phoenix.end2end.SpooledOrderByIT Tests run: 2, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 5.427 sec - in org.apache.phoenix.end2end.SpooledOrderByIT Running org.apache.phoenix.end2end.ClientTimeArithmeticQueryIT Tests run: 11, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 42.435 sec - in org.apache.phoenix.end2end.CreateTableIT Running org.apache.phoenix.end2end.GroupByIT Tests run: 48, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 36.525 sec - in org.apache.phoenix.end2end.ArrayIT Running org.apache.phoenix.end2end.ProductMetricsIT Tests run: 36, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 63.15 sec - in org.apache.phoenix.end2end.RowValueConstructorIT Tests run: 61, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 33.556 sec - in org.apache.phoenix.end2end.ProductMetricsIT Tests run: 91, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 88.958 sec - in org.apache.phoenix.end2end.GroupByIT Tests run: 182, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 214.878 sec - in org.apache.phoenix.end2end.QueryIT Tests run: 210, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 180.561 sec - in org.apache.phoenix.end2end.ClientTimeArithmeticQueryIT Results : Tests run: 1224, Failures: 0, Errors: 0, Skipped: 0 [INFO] [failsafe:integration-test {execution: HBaseManagedTimeTests}] [INFO] Failsafe report directory: /x1/jenkins/jenkins-slave/workspace/Phoenix-4.2/phoenix-core/target/failsafe-reports [INFO] parallel='none', perCoreThreadCount=true, threadCount=0, useUnlimitedThreads=false, threadCountSuites=0, threadCountClasses=0, threadCountMethods=0, parallelOptimized=true --- T E S T S --- Running org.apache.phoenix.end2end.TenantSpecificViewIndexIT Running org.apache.phoenix.end2end.SkipScanQueryIT Running org.apache.phoenix.end2end.QueryExecWithoutSCNIT Running org.apache.phoenix.end2end.DeleteIT Running org.apache.phoenix.end2end.BinaryRowKeyIT Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 5.542 sec - in org.apache.phoenix.end2end.QueryExecWithoutSCNIT Running org.apache.phoenix.end2end.TenantSpecificViewIndexSaltedIT Tests run: 3, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 4.566 sec - in org.apache.phoenix.end2end.BinaryRowKeyIT Running org.apache.phoenix.end2end.EncodeFunctionIT Tests run: 6, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 11.393 sec - in org.apache.phoenix.end2end.EncodeFunctionIT Tests run: 8, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 18.894 sec - in org.apache.phoenix.end2end.SkipScanQueryIT Running org.apache.phoenix.end2end.AlterTableIT Running org.apache.phoenix.end2end.TimezoneOffsetFunctionIT Tests run: 7, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 23.59 sec - in org.apache.phoenix.end2end.TenantSpecificViewIndexIT Running org.apache.phoenix.end2end.index.MutableIndexIT Tests run: 6, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 4.514 sec - in org.apache.phoenix.end2end.TimezoneOffsetFunctionIT Tests run: 4, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 18.767 sec - in org.apache.phoenix.end2end.TenantSpecificViewIndexSaltedIT Running org.apache.phoenix.end2end.index.ViewIndexIT Running org.apache.phoenix.end2end.index.DropViewIT Tests run: 20, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 31.763 sec - in org.apache.phoenix.end2end.DeleteIT Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 7.061 sec - in org.apache.phoenix.end2end.index.ViewIndexIT Running org.apache.phoenix.end2end.index.IndexMetadataIT Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 7.171 sec - in org.apache.phoenix.end2end.index.DropViewIT Running org.apache.phoenix.end2end.index.SaltedIndexIT Running org.apache.phoenix.end2end.index.LocalIndexIT Tests run: 3, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 28.524 sec - in org.apache.phoenix.end2end.index.SaltedIndexIT