[17/28] phoenix git commit: PHOENIX-4841 staging patch commit.
PHOENIX-4841 staging patch commit. Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/1c656192 Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/1c656192 Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/1c656192 Branch: refs/heads/4.x-cdh5.15 Commit: 1c656192f6d0ea061630c7d1ef8ab3f0970e7071 Parents: bcf2cc7 Author: Daniel Wong Authored: Wed Oct 10 00:38:11 2018 +0100 Committer: Pedro Boado Committed: Tue Nov 27 15:11:54 2018 + -- .../org/apache/phoenix/end2end/QueryMoreIT.java | 171 +-- .../apache/phoenix/compile/WhereOptimizer.java | 58 ++- .../expression/ComparisonExpression.java| 18 +- .../RowValueConstructorExpressionRewriter.java | 54 ++ .../org/apache/phoenix/schema/RowKeySchema.java | 4 + ...wValueConstructorExpressionRewriterTest.java | 78 + 6 files changed, 362 insertions(+), 21 deletions(-) -- http://git-wip-us.apache.org/repos/asf/phoenix/blob/1c656192/phoenix-core/src/it/java/org/apache/phoenix/end2end/QueryMoreIT.java -- diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/QueryMoreIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/QueryMoreIT.java index 04272fa..2b1d31e 100644 --- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/QueryMoreIT.java +++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/QueryMoreIT.java @@ -17,11 +17,13 @@ */ package org.apache.phoenix.end2end; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertNull; -import static org.junit.Assert.assertTrue; +import com.google.common.collect.Lists; +import org.apache.hadoop.hbase.util.Pair; +import org.apache.phoenix.jdbc.PhoenixConnection; +import org.apache.phoenix.query.QueryServices; +import org.apache.phoenix.util.PhoenixRuntime; +import org.apache.phoenix.util.TestUtil; +import org.junit.Test; import java.sql.Connection; import java.sql.Date; @@ -37,18 +39,19 @@ import java.util.Map; import java.util.Properties; import org.apache.hadoop.hbase.util.Base64; -import org.apache.hadoop.hbase.util.Pair; -import org.apache.phoenix.jdbc.PhoenixConnection; -import org.apache.phoenix.query.QueryServices; -import org.apache.phoenix.util.PhoenixRuntime; -import org.apache.phoenix.util.TestUtil; -import org.junit.Test; -import com.google.common.collect.Lists; +import static org.apache.phoenix.util.PhoenixRuntime.TENANT_ID_ATTRIB; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertNull; +import static org.junit.Assert.assertTrue; public class QueryMoreIT extends ParallelStatsDisabledIT { +private final String TENANT_SPECIFIC_URL1 = getUrl() + ';' + TENANT_ID_ATTRIB + "=tenant1"; + private String dataTableName; //queryAgainstTenantSpecificView = true, dataTableSalted = true @Test @@ -510,4 +513,148 @@ public class QueryMoreIT extends ParallelStatsDisabledIT { stmt.execute(); } } + +@Test public void testRVCWithDescAndAscendingPK() throws Exception { +final Connection conn = DriverManager.getConnection(getUrl()); +String fullTableName = generateUniqueName(); +try (Statement stmt = conn.createStatement()) { +stmt.execute("CREATE TABLE " + fullTableName + "(\n" ++ "ORGANIZATION_ID CHAR(15) NOT NULL,\n" + "SCORE VARCHAR NOT NULL,\n" ++ "ENTITY_ID VARCHAR NOT NULL\n" ++ "CONSTRAINT PAGE_SNAPSHOT_PK PRIMARY KEY (\n" ++ "ORGANIZATION_ID,\n" + "SCORE DESC,\n" + "ENTITY_ID\n" ++ ")\n" + ") MULTI_TENANT=TRUE"); +} + +conn.createStatement().execute("UPSERT INTO " + fullTableName + " VALUES ('org1','c','1')"); +conn.createStatement().execute("UPSERT INTO " + fullTableName + " VALUES ('org1','b','3')"); +conn.createStatement().execute("UPSERT INTO " + fullTableName + " VALUES ('org1','b','4')"); +conn.createStatement().execute("UPSERT INTO " + fullTableName + " VALUES ('org1','a','2')"); +conn.commit(); + +try (Statement stmt = conn.createStatement()) { +final ResultSet +rs = +stmt.executeQuery("SELECT score, entity_id \n" + "FROM " + fullTableName + "\n" ++ "WHERE organization_id = 'org1'\n" ++ "AND (score, entity_id) < ('b', '4')\n" ++ "ORDER BY score DESC,
[1/9] phoenix git commit: PHOENIX-4841 staging patch commit.
Repository: phoenix Updated Branches: refs/heads/omid2 e02b3a278 -> 06b2ffd90 PHOENIX-4841 staging patch commit. Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/87e77029 Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/87e77029 Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/87e77029 Branch: refs/heads/omid2 Commit: 87e7702966ab7bc0afd52696e453f57ccc28b369 Parents: 7b038fb Author: Daniel Wong Authored: Tue Oct 9 16:38:11 2018 -0700 Committer: Thomas D'Silva Committed: Thu Nov 15 12:00:51 2018 -0800 -- .../org/apache/phoenix/end2end/QueryMoreIT.java | 171 +-- .../apache/phoenix/compile/WhereOptimizer.java | 58 ++- .../expression/ComparisonExpression.java| 18 +- .../RowValueConstructorExpressionRewriter.java | 54 ++ .../org/apache/phoenix/schema/RowKeySchema.java | 4 + ...wValueConstructorExpressionRewriterTest.java | 78 + 6 files changed, 362 insertions(+), 21 deletions(-) -- http://git-wip-us.apache.org/repos/asf/phoenix/blob/87e77029/phoenix-core/src/it/java/org/apache/phoenix/end2end/QueryMoreIT.java -- diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/QueryMoreIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/QueryMoreIT.java index 04272fa..2b1d31e 100644 --- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/QueryMoreIT.java +++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/QueryMoreIT.java @@ -17,11 +17,13 @@ */ package org.apache.phoenix.end2end; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertNull; -import static org.junit.Assert.assertTrue; +import com.google.common.collect.Lists; +import org.apache.hadoop.hbase.util.Pair; +import org.apache.phoenix.jdbc.PhoenixConnection; +import org.apache.phoenix.query.QueryServices; +import org.apache.phoenix.util.PhoenixRuntime; +import org.apache.phoenix.util.TestUtil; +import org.junit.Test; import java.sql.Connection; import java.sql.Date; @@ -37,18 +39,19 @@ import java.util.Map; import java.util.Properties; import org.apache.hadoop.hbase.util.Base64; -import org.apache.hadoop.hbase.util.Pair; -import org.apache.phoenix.jdbc.PhoenixConnection; -import org.apache.phoenix.query.QueryServices; -import org.apache.phoenix.util.PhoenixRuntime; -import org.apache.phoenix.util.TestUtil; -import org.junit.Test; -import com.google.common.collect.Lists; +import static org.apache.phoenix.util.PhoenixRuntime.TENANT_ID_ATTRIB; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertNull; +import static org.junit.Assert.assertTrue; public class QueryMoreIT extends ParallelStatsDisabledIT { +private final String TENANT_SPECIFIC_URL1 = getUrl() + ';' + TENANT_ID_ATTRIB + "=tenant1"; + private String dataTableName; //queryAgainstTenantSpecificView = true, dataTableSalted = true @Test @@ -510,4 +513,148 @@ public class QueryMoreIT extends ParallelStatsDisabledIT { stmt.execute(); } } + +@Test public void testRVCWithDescAndAscendingPK() throws Exception { +final Connection conn = DriverManager.getConnection(getUrl()); +String fullTableName = generateUniqueName(); +try (Statement stmt = conn.createStatement()) { +stmt.execute("CREATE TABLE " + fullTableName + "(\n" ++ "ORGANIZATION_ID CHAR(15) NOT NULL,\n" + "SCORE VARCHAR NOT NULL,\n" ++ "ENTITY_ID VARCHAR NOT NULL\n" ++ "CONSTRAINT PAGE_SNAPSHOT_PK PRIMARY KEY (\n" ++ "ORGANIZATION_ID,\n" + "SCORE DESC,\n" + "ENTITY_ID\n" ++ ")\n" + ") MULTI_TENANT=TRUE"); +} + +conn.createStatement().execute("UPSERT INTO " + fullTableName + " VALUES ('org1','c','1')"); +conn.createStatement().execute("UPSERT INTO " + fullTableName + " VALUES ('org1','b','3')"); +conn.createStatement().execute("UPSERT INTO " + fullTableName + " VALUES ('org1','b','4')"); +conn.createStatement().execute("UPSERT INTO " + fullTableName + " VALUES ('org1','a','2')"); +conn.commit(); + +try (Statement stmt = conn.createStatement()) { +final ResultSet +rs = +stmt.executeQuery("SELECT score, entity_id \n" + "FROM " + fullTableName + "\n" ++ "WHERE organization_id = 'org1'\n" ++ "AND (score,
phoenix git commit: PHOENIX-4841 staging patch commit.
Repository: phoenix Updated Branches: refs/heads/master 6c286dbfe -> 3690c6323 PHOENIX-4841 staging patch commit. Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/3690c632 Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/3690c632 Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/3690c632 Branch: refs/heads/master Commit: 3690c6323e3690e8811c326dc7c57c641e79aef5 Parents: 6c286db Author: Daniel Wong Authored: Tue Oct 9 16:38:11 2018 -0700 Committer: Thomas D'Silva Committed: Thu Nov 15 14:21:24 2018 -0800 -- .../org/apache/phoenix/end2end/QueryMoreIT.java | 174 +-- .../apache/phoenix/compile/WhereOptimizer.java | 58 ++- .../expression/ComparisonExpression.java| 18 +- .../RowValueConstructorExpressionRewriter.java | 54 ++ .../org/apache/phoenix/schema/RowKeySchema.java | 4 + ...wValueConstructorExpressionRewriterTest.java | 78 + 6 files changed, 363 insertions(+), 23 deletions(-) -- http://git-wip-us.apache.org/repos/asf/phoenix/blob/3690c632/phoenix-core/src/it/java/org/apache/phoenix/end2end/QueryMoreIT.java -- diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/QueryMoreIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/QueryMoreIT.java index 528fe7f..9e7e144 100644 --- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/QueryMoreIT.java +++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/QueryMoreIT.java @@ -17,11 +17,14 @@ */ package org.apache.phoenix.end2end; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertNull; -import static org.junit.Assert.assertTrue; +import com.google.common.collect.Lists; +import org.apache.hadoop.hbase.util.Bytes; +import org.apache.hadoop.hbase.util.Pair; +import org.apache.phoenix.jdbc.PhoenixConnection; +import org.apache.phoenix.query.QueryServices; +import org.apache.phoenix.util.PhoenixRuntime; +import org.apache.phoenix.util.TestUtil; +import org.junit.Test; import java.sql.Connection; import java.sql.Date; @@ -37,19 +40,18 @@ import java.util.List; import java.util.Map; import java.util.Properties; -import org.apache.hadoop.hbase.util.Bytes; -import org.apache.hadoop.hbase.util.Pair; -import org.apache.phoenix.jdbc.PhoenixConnection; -import org.apache.phoenix.query.QueryServices; -import org.apache.phoenix.util.PhoenixRuntime; -import org.apache.phoenix.util.TestUtil; -import org.junit.Test; - -import com.google.common.collect.Lists; +import static org.apache.phoenix.util.PhoenixRuntime.TENANT_ID_ATTRIB; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertNull; +import static org.junit.Assert.assertTrue; public class QueryMoreIT extends ParallelStatsDisabledIT { +private final String TENANT_SPECIFIC_URL1 = getUrl() + ';' + TENANT_ID_ATTRIB + "=tenant1"; + private String dataTableName; //queryAgainstTenantSpecificView = true, dataTableSalted = true @Test @@ -511,4 +513,148 @@ public class QueryMoreIT extends ParallelStatsDisabledIT { stmt.execute(); } } + +@Test public void testRVCWithDescAndAscendingPK() throws Exception { +final Connection conn = DriverManager.getConnection(getUrl()); +String fullTableName = generateUniqueName(); +try (Statement stmt = conn.createStatement()) { +stmt.execute("CREATE TABLE " + fullTableName + "(\n" ++ "ORGANIZATION_ID CHAR(15) NOT NULL,\n" + "SCORE VARCHAR NOT NULL,\n" ++ "ENTITY_ID VARCHAR NOT NULL\n" ++ "CONSTRAINT PAGE_SNAPSHOT_PK PRIMARY KEY (\n" ++ "ORGANIZATION_ID,\n" + "SCORE DESC,\n" + "ENTITY_ID\n" ++ ")\n" + ") MULTI_TENANT=TRUE"); +} + +conn.createStatement().execute("UPSERT INTO " + fullTableName + " VALUES ('org1','c','1')"); +conn.createStatement().execute("UPSERT INTO " + fullTableName + " VALUES ('org1','b','3')"); +conn.createStatement().execute("UPSERT INTO " + fullTableName + " VALUES ('org1','b','4')"); +conn.createStatement().execute("UPSERT INTO " + fullTableName + " VALUES ('org1','a','2')"); +conn.commit(); + +try (Statement stmt = conn.createStatement()) { +final ResultSet +rs = +stmt.executeQuery("SELECT score, entity_id \n" + "FROM " + fullTableName + "\n" ++ "WHERE
phoenix git commit: PHOENIX-4841 staging patch commit.
Repository: phoenix Updated Branches: refs/heads/4.x-HBase-1.4 4f8720b16 -> 590fec910 PHOENIX-4841 staging patch commit. Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/590fec91 Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/590fec91 Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/590fec91 Branch: refs/heads/4.x-HBase-1.4 Commit: 590fec910051648bc71c577262eab3f978b659ca Parents: 4f8720b Author: Daniel Wong Authored: Tue Oct 9 16:38:11 2018 -0700 Committer: Thomas D'Silva Committed: Thu Nov 15 12:14:12 2018 -0800 -- .../org/apache/phoenix/end2end/QueryMoreIT.java | 171 +-- .../apache/phoenix/compile/WhereOptimizer.java | 58 ++- .../expression/ComparisonExpression.java| 18 +- .../RowValueConstructorExpressionRewriter.java | 54 ++ .../org/apache/phoenix/schema/RowKeySchema.java | 4 + ...wValueConstructorExpressionRewriterTest.java | 78 + 6 files changed, 362 insertions(+), 21 deletions(-) -- http://git-wip-us.apache.org/repos/asf/phoenix/blob/590fec91/phoenix-core/src/it/java/org/apache/phoenix/end2end/QueryMoreIT.java -- diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/QueryMoreIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/QueryMoreIT.java index 04272fa..2b1d31e 100644 --- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/QueryMoreIT.java +++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/QueryMoreIT.java @@ -17,11 +17,13 @@ */ package org.apache.phoenix.end2end; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertNull; -import static org.junit.Assert.assertTrue; +import com.google.common.collect.Lists; +import org.apache.hadoop.hbase.util.Pair; +import org.apache.phoenix.jdbc.PhoenixConnection; +import org.apache.phoenix.query.QueryServices; +import org.apache.phoenix.util.PhoenixRuntime; +import org.apache.phoenix.util.TestUtil; +import org.junit.Test; import java.sql.Connection; import java.sql.Date; @@ -37,18 +39,19 @@ import java.util.Map; import java.util.Properties; import org.apache.hadoop.hbase.util.Base64; -import org.apache.hadoop.hbase.util.Pair; -import org.apache.phoenix.jdbc.PhoenixConnection; -import org.apache.phoenix.query.QueryServices; -import org.apache.phoenix.util.PhoenixRuntime; -import org.apache.phoenix.util.TestUtil; -import org.junit.Test; -import com.google.common.collect.Lists; +import static org.apache.phoenix.util.PhoenixRuntime.TENANT_ID_ATTRIB; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertNull; +import static org.junit.Assert.assertTrue; public class QueryMoreIT extends ParallelStatsDisabledIT { +private final String TENANT_SPECIFIC_URL1 = getUrl() + ';' + TENANT_ID_ATTRIB + "=tenant1"; + private String dataTableName; //queryAgainstTenantSpecificView = true, dataTableSalted = true @Test @@ -510,4 +513,148 @@ public class QueryMoreIT extends ParallelStatsDisabledIT { stmt.execute(); } } + +@Test public void testRVCWithDescAndAscendingPK() throws Exception { +final Connection conn = DriverManager.getConnection(getUrl()); +String fullTableName = generateUniqueName(); +try (Statement stmt = conn.createStatement()) { +stmt.execute("CREATE TABLE " + fullTableName + "(\n" ++ "ORGANIZATION_ID CHAR(15) NOT NULL,\n" + "SCORE VARCHAR NOT NULL,\n" ++ "ENTITY_ID VARCHAR NOT NULL\n" ++ "CONSTRAINT PAGE_SNAPSHOT_PK PRIMARY KEY (\n" ++ "ORGANIZATION_ID,\n" + "SCORE DESC,\n" + "ENTITY_ID\n" ++ ")\n" + ") MULTI_TENANT=TRUE"); +} + +conn.createStatement().execute("UPSERT INTO " + fullTableName + " VALUES ('org1','c','1')"); +conn.createStatement().execute("UPSERT INTO " + fullTableName + " VALUES ('org1','b','3')"); +conn.createStatement().execute("UPSERT INTO " + fullTableName + " VALUES ('org1','b','4')"); +conn.createStatement().execute("UPSERT INTO " + fullTableName + " VALUES ('org1','a','2')"); +conn.commit(); + +try (Statement stmt = conn.createStatement()) { +final ResultSet +rs = +stmt.executeQuery("SELECT score, entity_id \n" + "FROM " + fullTableName + "\n" ++ "WHERE organization_id = 'org1'\n" ++ "AND
phoenix git commit: PHOENIX-4841 staging patch commit.
Repository: phoenix Updated Branches: refs/heads/4.x-HBase-1.2 55bccf6b0 -> d35870043 PHOENIX-4841 staging patch commit. Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/d3587004 Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/d3587004 Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/d3587004 Branch: refs/heads/4.x-HBase-1.2 Commit: d358700432c1b6f080f6ec9cbab43ea6f244db85 Parents: 55bccf6 Author: Daniel Wong Authored: Tue Oct 9 16:38:11 2018 -0700 Committer: Thomas D'Silva Committed: Thu Nov 15 12:00:37 2018 -0800 -- .../org/apache/phoenix/end2end/QueryMoreIT.java | 171 +-- .../apache/phoenix/compile/WhereOptimizer.java | 58 ++- .../expression/ComparisonExpression.java| 18 +- .../RowValueConstructorExpressionRewriter.java | 54 ++ .../org/apache/phoenix/schema/RowKeySchema.java | 4 + ...wValueConstructorExpressionRewriterTest.java | 78 + 6 files changed, 362 insertions(+), 21 deletions(-) -- http://git-wip-us.apache.org/repos/asf/phoenix/blob/d3587004/phoenix-core/src/it/java/org/apache/phoenix/end2end/QueryMoreIT.java -- diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/QueryMoreIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/QueryMoreIT.java index 04272fa..2b1d31e 100644 --- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/QueryMoreIT.java +++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/QueryMoreIT.java @@ -17,11 +17,13 @@ */ package org.apache.phoenix.end2end; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertNull; -import static org.junit.Assert.assertTrue; +import com.google.common.collect.Lists; +import org.apache.hadoop.hbase.util.Pair; +import org.apache.phoenix.jdbc.PhoenixConnection; +import org.apache.phoenix.query.QueryServices; +import org.apache.phoenix.util.PhoenixRuntime; +import org.apache.phoenix.util.TestUtil; +import org.junit.Test; import java.sql.Connection; import java.sql.Date; @@ -37,18 +39,19 @@ import java.util.Map; import java.util.Properties; import org.apache.hadoop.hbase.util.Base64; -import org.apache.hadoop.hbase.util.Pair; -import org.apache.phoenix.jdbc.PhoenixConnection; -import org.apache.phoenix.query.QueryServices; -import org.apache.phoenix.util.PhoenixRuntime; -import org.apache.phoenix.util.TestUtil; -import org.junit.Test; -import com.google.common.collect.Lists; +import static org.apache.phoenix.util.PhoenixRuntime.TENANT_ID_ATTRIB; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertNull; +import static org.junit.Assert.assertTrue; public class QueryMoreIT extends ParallelStatsDisabledIT { +private final String TENANT_SPECIFIC_URL1 = getUrl() + ';' + TENANT_ID_ATTRIB + "=tenant1"; + private String dataTableName; //queryAgainstTenantSpecificView = true, dataTableSalted = true @Test @@ -510,4 +513,148 @@ public class QueryMoreIT extends ParallelStatsDisabledIT { stmt.execute(); } } + +@Test public void testRVCWithDescAndAscendingPK() throws Exception { +final Connection conn = DriverManager.getConnection(getUrl()); +String fullTableName = generateUniqueName(); +try (Statement stmt = conn.createStatement()) { +stmt.execute("CREATE TABLE " + fullTableName + "(\n" ++ "ORGANIZATION_ID CHAR(15) NOT NULL,\n" + "SCORE VARCHAR NOT NULL,\n" ++ "ENTITY_ID VARCHAR NOT NULL\n" ++ "CONSTRAINT PAGE_SNAPSHOT_PK PRIMARY KEY (\n" ++ "ORGANIZATION_ID,\n" + "SCORE DESC,\n" + "ENTITY_ID\n" ++ ")\n" + ") MULTI_TENANT=TRUE"); +} + +conn.createStatement().execute("UPSERT INTO " + fullTableName + " VALUES ('org1','c','1')"); +conn.createStatement().execute("UPSERT INTO " + fullTableName + " VALUES ('org1','b','3')"); +conn.createStatement().execute("UPSERT INTO " + fullTableName + " VALUES ('org1','b','4')"); +conn.createStatement().execute("UPSERT INTO " + fullTableName + " VALUES ('org1','a','2')"); +conn.commit(); + +try (Statement stmt = conn.createStatement()) { +final ResultSet +rs = +stmt.executeQuery("SELECT score, entity_id \n" + "FROM " + fullTableName + "\n" ++ "WHERE organization_id = 'org1'\n" ++ "AND
phoenix git commit: PHOENIX-4841 staging patch commit.
Repository: phoenix Updated Branches: refs/heads/4.x-HBase-1.3 7b038fba5 -> 87e770296 PHOENIX-4841 staging patch commit. Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/87e77029 Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/87e77029 Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/87e77029 Branch: refs/heads/4.x-HBase-1.3 Commit: 87e7702966ab7bc0afd52696e453f57ccc28b369 Parents: 7b038fb Author: Daniel Wong Authored: Tue Oct 9 16:38:11 2018 -0700 Committer: Thomas D'Silva Committed: Thu Nov 15 12:00:51 2018 -0800 -- .../org/apache/phoenix/end2end/QueryMoreIT.java | 171 +-- .../apache/phoenix/compile/WhereOptimizer.java | 58 ++- .../expression/ComparisonExpression.java| 18 +- .../RowValueConstructorExpressionRewriter.java | 54 ++ .../org/apache/phoenix/schema/RowKeySchema.java | 4 + ...wValueConstructorExpressionRewriterTest.java | 78 + 6 files changed, 362 insertions(+), 21 deletions(-) -- http://git-wip-us.apache.org/repos/asf/phoenix/blob/87e77029/phoenix-core/src/it/java/org/apache/phoenix/end2end/QueryMoreIT.java -- diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/QueryMoreIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/QueryMoreIT.java index 04272fa..2b1d31e 100644 --- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/QueryMoreIT.java +++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/QueryMoreIT.java @@ -17,11 +17,13 @@ */ package org.apache.phoenix.end2end; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertNull; -import static org.junit.Assert.assertTrue; +import com.google.common.collect.Lists; +import org.apache.hadoop.hbase.util.Pair; +import org.apache.phoenix.jdbc.PhoenixConnection; +import org.apache.phoenix.query.QueryServices; +import org.apache.phoenix.util.PhoenixRuntime; +import org.apache.phoenix.util.TestUtil; +import org.junit.Test; import java.sql.Connection; import java.sql.Date; @@ -37,18 +39,19 @@ import java.util.Map; import java.util.Properties; import org.apache.hadoop.hbase.util.Base64; -import org.apache.hadoop.hbase.util.Pair; -import org.apache.phoenix.jdbc.PhoenixConnection; -import org.apache.phoenix.query.QueryServices; -import org.apache.phoenix.util.PhoenixRuntime; -import org.apache.phoenix.util.TestUtil; -import org.junit.Test; -import com.google.common.collect.Lists; +import static org.apache.phoenix.util.PhoenixRuntime.TENANT_ID_ATTRIB; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertNull; +import static org.junit.Assert.assertTrue; public class QueryMoreIT extends ParallelStatsDisabledIT { +private final String TENANT_SPECIFIC_URL1 = getUrl() + ';' + TENANT_ID_ATTRIB + "=tenant1"; + private String dataTableName; //queryAgainstTenantSpecificView = true, dataTableSalted = true @Test @@ -510,4 +513,148 @@ public class QueryMoreIT extends ParallelStatsDisabledIT { stmt.execute(); } } + +@Test public void testRVCWithDescAndAscendingPK() throws Exception { +final Connection conn = DriverManager.getConnection(getUrl()); +String fullTableName = generateUniqueName(); +try (Statement stmt = conn.createStatement()) { +stmt.execute("CREATE TABLE " + fullTableName + "(\n" ++ "ORGANIZATION_ID CHAR(15) NOT NULL,\n" + "SCORE VARCHAR NOT NULL,\n" ++ "ENTITY_ID VARCHAR NOT NULL\n" ++ "CONSTRAINT PAGE_SNAPSHOT_PK PRIMARY KEY (\n" ++ "ORGANIZATION_ID,\n" + "SCORE DESC,\n" + "ENTITY_ID\n" ++ ")\n" + ") MULTI_TENANT=TRUE"); +} + +conn.createStatement().execute("UPSERT INTO " + fullTableName + " VALUES ('org1','c','1')"); +conn.createStatement().execute("UPSERT INTO " + fullTableName + " VALUES ('org1','b','3')"); +conn.createStatement().execute("UPSERT INTO " + fullTableName + " VALUES ('org1','b','4')"); +conn.createStatement().execute("UPSERT INTO " + fullTableName + " VALUES ('org1','a','2')"); +conn.commit(); + +try (Statement stmt = conn.createStatement()) { +final ResultSet +rs = +stmt.executeQuery("SELECT score, entity_id \n" + "FROM " + fullTableName + "\n" ++ "WHERE organization_id = 'org1'\n" ++ "AND