This is an automated email from the ASF dual-hosted git repository.

vjasani pushed a commit to branch 5.1
in repository https://gitbox.apache.org/repos/asf/phoenix.git


The following commit(s) were added to refs/heads/5.1 by this push:
     new 73d324de49 PHOENIX-7365 ExplainPlanV2 should get trimmed list for 
regionserver location (#1940)
73d324de49 is described below

commit 73d324de49a011e89861eec613b60238e7053067
Author: Viraj Jasani <[email protected]>
AuthorDate: Fri Jul 19 12:34:41 2024 -0800

    PHOENIX-7365 ExplainPlanV2 should get trimmed list for regionserver 
location (#1940)
---
 .../it/java/org/apache/phoenix/end2end/FlappingLocalIndexIT.java | 9 +++++++--
 .../src/main/java/org/apache/phoenix/iterate/ExplainTable.java   | 8 ++++----
 2 files changed, 11 insertions(+), 6 deletions(-)

diff --git 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/FlappingLocalIndexIT.java 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/FlappingLocalIndexIT.java
index 80b877272a..d5ba002251 100644
--- 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/FlappingLocalIndexIT.java
+++ 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/FlappingLocalIndexIT.java
@@ -159,7 +159,9 @@ public class FlappingLocalIndexIT extends BaseLocalIndexIT {
             
             Admin admin = driver.getConnectionQueryServices(getUrl(), 
TestUtil.TEST_PROPERTIES).getAdmin();
             int numRegions = admin.getTableRegions(physicalTableName).size();
-            
+            int trimmedRegionLocations = admin.getConfiguration()
+                .getInt(QueryServices.MAX_REGION_LOCATIONS_SIZE_EXPLAIN_PLAN, 
-1);
+
             String query = "SELECT * FROM " + tableName +" where v1 like 'a%'";
 
             String explainPlanOutput =
@@ -186,6 +188,8 @@ public class FlappingLocalIndexIT extends BaseLocalIndexIT {
                 explainPlanAttributes.getServerWhereFilter());
             assertEquals("CLIENT MERGE SORT",
                 explainPlanAttributes.getClientSortAlgo());
+            assertEquals(trimmedRegionLocations,
+                explainPlanAttributes.getRegionLocations().size());
 
             rs = conn1.createStatement().executeQuery(query);
             assertTrue(rs.next());
@@ -219,7 +223,8 @@ public class FlappingLocalIndexIT extends BaseLocalIndexIT {
                 explainPlanAttributes.getServerWhereFilter());
             assertEquals("CLIENT MERGE SORT",
                 explainPlanAttributes.getClientSortAlgo());
-            assertEquals(numRegions, 
explainPlanAttributes.getRegionLocations().size());
+            assertEquals(trimmedRegionLocations,
+                    explainPlanAttributes.getRegionLocations().size());
 
             rs = conn1.createStatement().executeQuery(query);
             assertTrue(rs.next());
diff --git 
a/phoenix-core/src/main/java/org/apache/phoenix/iterate/ExplainTable.java 
b/phoenix-core/src/main/java/org/apache/phoenix/iterate/ExplainTable.java
index 458260ff21..5da00365a5 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/iterate/ExplainTable.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/iterate/ExplainTable.java
@@ -350,14 +350,14 @@ public abstract class ExplainTable {
             int maxLimitRegionLoc = 
context.getConnection().getQueryServices().getConfiguration()
                     
.getInt(QueryServices.MAX_REGION_LOCATIONS_SIZE_EXPLAIN_PLAN,
                             
QueryServicesOptions.DEFAULT_MAX_REGION_LOCATIONS_SIZE_EXPLAIN_PLAN);
-            if (explainPlanAttributesBuilder != null) {
-                explainPlanAttributesBuilder.setRegionLocations(
-                        Collections.unmodifiableList(regionLocations));
-            }
             if (regionLocations.size() > maxLimitRegionLoc) {
                 int originalSize = regionLocations.size();
                 List<HRegionLocation> trimmedRegionLocations =
                         regionLocations.subList(0, maxLimitRegionLoc);
+                if (explainPlanAttributesBuilder != null) {
+                    explainPlanAttributesBuilder.setRegionLocations(
+                        Collections.unmodifiableList(trimmedRegionLocations));
+                }
                 buf.append(trimmedRegionLocations);
                 buf.append("...total size = ");
                 buf.append(originalSize);

Reply via email to