(phoenix) branch 5.2 updated: PHOENIX-7258: Query Optimizer should pick Index hint even for point lookup queries (#1851)
This is an automated email from the ASF dual-hosted git repository. vjasani pushed a commit to branch 5.2 in repository https://gitbox.apache.org/repos/asf/phoenix.git The following commit(s) were added to refs/heads/5.2 by this push: new e9a74463e3 PHOENIX-7258: Query Optimizer should pick Index hint even for point lookup queries (#1851) e9a74463e3 is described below commit e9a74463e3454095051c3fbb1498aaf0acc8f485 Author: sanjeet006py <36011005+sanjeet00...@users.noreply.github.com> AuthorDate: Sat Mar 9 11:03:29 2024 +0530 PHOENIX-7258: Query Optimizer should pick Index hint even for point lookup queries (#1851) --- .../apache/phoenix/optimize/QueryOptimizer.java| 5 +- .../end2end/RowValueConstructorOffsetIT.java | 26 ++ .../phoenix/end2end/TenantSpecificTablesDDLIT.java | 57 ++ .../phoenix/end2end/index/PartialIndexIT.java | 47 ++ .../index/UncoveredGlobalIndexRegionScannerIT.java | 43 5 files changed, 176 insertions(+), 2 deletions(-) diff --git a/phoenix-core-client/src/main/java/org/apache/phoenix/optimize/QueryOptimizer.java b/phoenix-core-client/src/main/java/org/apache/phoenix/optimize/QueryOptimizer.java index 7560f75229..faec49322b 100644 --- a/phoenix-core-client/src/main/java/org/apache/phoenix/optimize/QueryOptimizer.java +++ b/phoenix-core-client/src/main/java/org/apache/phoenix/optimize/QueryOptimizer.java @@ -210,8 +210,9 @@ public class QueryOptimizer { private List getApplicablePlansForSingleFlatQuery(QueryPlan dataPlan, PhoenixStatement statement, List targetColumns, ParallelIteratorFactory parallelIteratorFactory, boolean stopAtBestPlan) throws SQLException { SelectStatement select = (SelectStatement)dataPlan.getStatement(); -// Exit early if we have a point lookup as we can't get better than that -if (dataPlan.getContext().getScanRanges().isPointLookup() +String indexHint = select.getHint().getHint(Hint.INDEX); +// Exit early if we have a point lookup w/o index hint as we can't get better than that +if (indexHint == null && dataPlan.getContext().getScanRanges().isPointLookup() && stopAtBestPlan && dataPlan.isApplicable()) { return Collections. singletonList(dataPlan); } diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/RowValueConstructorOffsetIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/RowValueConstructorOffsetIT.java index 8e42d76515..8ee6de18bc 100644 --- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/RowValueConstructorOffsetIT.java +++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/RowValueConstructorOffsetIT.java @@ -42,6 +42,7 @@ import org.apache.phoenix.schema.PTableType; import org.apache.phoenix.schema.RowValueConstructorOffsetNotCoercibleException; import org.apache.phoenix.util.PhoenixRuntime; import org.apache.phoenix.util.PropertiesUtil; +import org.apache.phoenix.util.QueryUtil; import org.junit.AfterClass; import org.junit.BeforeClass; import org.junit.Test; @@ -1221,4 +1222,29 @@ public class RowValueConstructorOffsetIT extends ParallelStatsDisabledIT { } } +// Test point lookup over data table with index hint and hinted plan is not applicable +@Test +public void testRVCOffsetWithNotApplicableIndexHint() throws Exception { +String sql = String.format("SELECT /*+ INDEX(%s %s)*/ %s FROM %s " ++ "WHERE t_id = 'b' AND k1 = 2 AND k2 = 3 OFFSET (%s)=('a', 1, 2)", +TABLE_NAME, INDEX_NAME, TABLE_ROW_KEY,TABLE_NAME,TABLE_ROW_KEY); +try (Statement statement = conn.createStatement()){ +ResultSet rs = statement.executeQuery("EXPLAIN " + sql); +String actualQueryPlan = QueryUtil.getExplainPlan(rs); +// As hinted plan is not applicable so use data plan which is point lookup +assertTrue(actualQueryPlan.contains("POINT LOOKUP ON 1 KEY OVER " + TABLE_NAME)); +} +} + +@Test +public void testRVCOffsetWithNotApplicableDataPlanAndPointLookup() throws Exception { +//'ab' is not an integer so this fails +String failureSql = String.format("SELECT %s FROM %s " ++ "WHERE t_id = 'b' AND k1 = 2 AND k2 = 3 OFFSET (%s)=('a', 'ab', 2)", +TABLE_ROW_KEY,TABLE_NAME,TABLE_ROW_KEY); +try (Statement statement = conn.createStatement()){ +statement.execute(failureSql); +fail("Should not allow non coercible values to PK in RVC Offset"); +} catch (RowValueConstructorOffsetNotCoercibleException e) {} +} } diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/TenantSpecificTablesDDLIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/TenantSpecificTablesDDLIT.java index 5d82e9da8c..5a66f9c5d4 100644 ---
(phoenix) branch master updated: PHOENIX-7258: Query Optimizer should pick Index hint even for point lookup queries (#1851)
This is an automated email from the ASF dual-hosted git repository. vjasani pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/phoenix.git The following commit(s) were added to refs/heads/master by this push: new 3524dbd900 PHOENIX-7258: Query Optimizer should pick Index hint even for point lookup queries (#1851) 3524dbd900 is described below commit 3524dbd9007bb1534b40d378e18bb61b6f6902a7 Author: sanjeet006py <36011005+sanjeet00...@users.noreply.github.com> AuthorDate: Sat Mar 9 11:03:29 2024 +0530 PHOENIX-7258: Query Optimizer should pick Index hint even for point lookup queries (#1851) --- .../apache/phoenix/optimize/QueryOptimizer.java| 5 +- .../end2end/RowValueConstructorOffsetIT.java | 26 ++ .../phoenix/end2end/TenantSpecificTablesDDLIT.java | 57 ++ .../phoenix/end2end/index/PartialIndexIT.java | 47 ++ .../index/UncoveredGlobalIndexRegionScannerIT.java | 43 5 files changed, 176 insertions(+), 2 deletions(-) diff --git a/phoenix-core-client/src/main/java/org/apache/phoenix/optimize/QueryOptimizer.java b/phoenix-core-client/src/main/java/org/apache/phoenix/optimize/QueryOptimizer.java index 7560f75229..faec49322b 100644 --- a/phoenix-core-client/src/main/java/org/apache/phoenix/optimize/QueryOptimizer.java +++ b/phoenix-core-client/src/main/java/org/apache/phoenix/optimize/QueryOptimizer.java @@ -210,8 +210,9 @@ public class QueryOptimizer { private List getApplicablePlansForSingleFlatQuery(QueryPlan dataPlan, PhoenixStatement statement, List targetColumns, ParallelIteratorFactory parallelIteratorFactory, boolean stopAtBestPlan) throws SQLException { SelectStatement select = (SelectStatement)dataPlan.getStatement(); -// Exit early if we have a point lookup as we can't get better than that -if (dataPlan.getContext().getScanRanges().isPointLookup() +String indexHint = select.getHint().getHint(Hint.INDEX); +// Exit early if we have a point lookup w/o index hint as we can't get better than that +if (indexHint == null && dataPlan.getContext().getScanRanges().isPointLookup() && stopAtBestPlan && dataPlan.isApplicable()) { return Collections. singletonList(dataPlan); } diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/RowValueConstructorOffsetIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/RowValueConstructorOffsetIT.java index 8e42d76515..8ee6de18bc 100644 --- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/RowValueConstructorOffsetIT.java +++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/RowValueConstructorOffsetIT.java @@ -42,6 +42,7 @@ import org.apache.phoenix.schema.PTableType; import org.apache.phoenix.schema.RowValueConstructorOffsetNotCoercibleException; import org.apache.phoenix.util.PhoenixRuntime; import org.apache.phoenix.util.PropertiesUtil; +import org.apache.phoenix.util.QueryUtil; import org.junit.AfterClass; import org.junit.BeforeClass; import org.junit.Test; @@ -1221,4 +1222,29 @@ public class RowValueConstructorOffsetIT extends ParallelStatsDisabledIT { } } +// Test point lookup over data table with index hint and hinted plan is not applicable +@Test +public void testRVCOffsetWithNotApplicableIndexHint() throws Exception { +String sql = String.format("SELECT /*+ INDEX(%s %s)*/ %s FROM %s " ++ "WHERE t_id = 'b' AND k1 = 2 AND k2 = 3 OFFSET (%s)=('a', 1, 2)", +TABLE_NAME, INDEX_NAME, TABLE_ROW_KEY,TABLE_NAME,TABLE_ROW_KEY); +try (Statement statement = conn.createStatement()){ +ResultSet rs = statement.executeQuery("EXPLAIN " + sql); +String actualQueryPlan = QueryUtil.getExplainPlan(rs); +// As hinted plan is not applicable so use data plan which is point lookup +assertTrue(actualQueryPlan.contains("POINT LOOKUP ON 1 KEY OVER " + TABLE_NAME)); +} +} + +@Test +public void testRVCOffsetWithNotApplicableDataPlanAndPointLookup() throws Exception { +//'ab' is not an integer so this fails +String failureSql = String.format("SELECT %s FROM %s " ++ "WHERE t_id = 'b' AND k1 = 2 AND k2 = 3 OFFSET (%s)=('a', 'ab', 2)", +TABLE_ROW_KEY,TABLE_NAME,TABLE_ROW_KEY); +try (Statement statement = conn.createStatement()){ +statement.execute(failureSql); +fail("Should not allow non coercible values to PK in RVC Offset"); +} catch (RowValueConstructorOffsetNotCoercibleException e) {} +} } diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/TenantSpecificTablesDDLIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/TenantSpecificTablesDDLIT.java index 5d82e9da8c..5a66f9c5d4 100644 ---
Apache-Phoenix | master | HBase 2.5 | Build #659 FAILURE
master branch HBase 2.5 build #659 status FAILURE Build #659 https://ci-hadoop.apache.org/job/Phoenix/job/Phoenix-mulitbranch/job/master/659/
Apache-Phoenix | master | HBase 2.4 | Build #659 FAILURE
master branch HBase 2.4 build #659 status FAILURE Build #659 https://ci-hadoop.apache.org/job/Phoenix/job/Phoenix-mulitbranch/job/master/659/
(phoenix-queryserver) branch master updated (a5af0c9 -> 7c76899)
This is an automated email from the ASF dual-hosted git repository. stoty pushed a change to branch master in repository https://gitbox.apache.org/repos/asf/phoenix-queryserver.git from a5af0c9 PHOENIX-7246 Crash Due to Unhandled JDBC Type Code 0 for NULL Values add 7c76899 PHOENIX-7256 Set java.io.tmpdir to the maven build directory for tests in PQS No new revisions were added by this update. Summary of changes: pom.xml | 7 +++ 1 file changed, 7 insertions(+)
(phoenix) branch master updated: PHOENIX-7255 Non-existent artifacts referred in compatible_client_versions.json
This is an automated email from the ASF dual-hosted git repository. stoty pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/phoenix.git The following commit(s) were added to refs/heads/master by this push: new 909f4bc174 PHOENIX-7255 Non-existent artifacts referred in compatible_client_versions.json 909f4bc174 is described below commit 909f4bc1741956e78db0b4343e53e548a0f470a1 Author: Istvan Toth AuthorDate: Fri Mar 8 08:00:07 2024 +0100 PHOENIX-7255 Non-existent artifacts referred in compatible_client_versions.json also remove old HBase 1.x entries also bump 5.1.0 to 5.1.2 for HBase 2.4, because pre 5.1.2 only supports 2.4.0 --- phoenix-core/src/it/resources/compatible_client_versions.json | 8 ++-- 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/phoenix-core/src/it/resources/compatible_client_versions.json b/phoenix-core/src/it/resources/compatible_client_versions.json index 037289bce0..547f2f9f92 100644 --- a/phoenix-core/src/it/resources/compatible_client_versions.json +++ b/phoenix-core/src/it/resources/compatible_client_versions.json @@ -17,13 +17,9 @@ */ { "_comment": "Lists all phoenix compatible client versions against the current branch version for a given hbase profile If hbase profile is 1.3, phoenix client versions 4.14.3 and 4.15.0 are tested against current branch version", -"1.3": [ {"artifactId":"phoenix-client", "version":"4.14.3-HBase-1.3"}, {"artifactId":"phoenix-client", "version":"4.15.0-HBase-1.3"}, {"artifactId":"phoenix-client-hbase-1.3", "version":"4.16.0"} ], -"1.4": [ {"artifactId":"phoenix-client", "version":"4.14.3-HBase-1.4"}, {"artifactId":"phoenix-client", "version":"4.15.0-HBase-1.4"}, {"artifactId":"phoenix-client-hbase-1.4", "version":"4.16.0"} ], -"1.5": [ {"artifactId":"phoenix-client", "version":"4.15-HBase-1.5"}, {"artifactId":"phoenix-client-hbase-1.5", "version":"4.16.0"} ], -"1.6": [ {"artifactId":"phoenix-client-hbase-1.6", "version":"4.16.0"} ], "2.1": [ {"artifactId":"phoenix-client-hbase-2.1", "version":"5.1.0"} ], "2.2": [ {"artifactId":"phoenix-client-hbase-2.2", "version":"5.1.0"} ], -"2.3": [ {"artifactId":"phoenix-client-hbase-2.3", "version":"5.1.0"}, {"artifactId":"phoenix-client-hbase-2.3", "version":"5.2.0"} ], -"2.4": [ {"artifactId":"phoenix-client-hbase-2.4", "version":"5.1.0"}, {"artifactId":"phoenix-client-hbase-2.3", "version":"5.2.0"} ], +"2.3": [ {"artifactId":"phoenix-client-hbase-2.3", "version":"5.1.0"} ], +"2.4": [ {"artifactId":"phoenix-client-hbase-2.4", "version":"5.1.2"} ], "2.5": [ {"artifactId":"phoenix-client-hbase-2.5", "version":"5.1.3"} ] }