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 98c619545c PHOENIX-7365 ExplainPlanV2 should get trimmed list for 
regionserver location (#1940)
98c619545c is described below

commit 98c619545c2368fc45ad33ea73204b8379bb6548
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)
---
 .../src/main/java/org/apache/phoenix/iterate/ExplainTable.java    | 8 ++++----
 .../it/java/org/apache/phoenix/end2end/FlappingLocalIndexIT.java  | 5 ++++-
 2 files changed, 8 insertions(+), 5 deletions(-)

diff --git 
a/phoenix-core-client/src/main/java/org/apache/phoenix/iterate/ExplainTable.java
 
b/phoenix-core-client/src/main/java/org/apache/phoenix/iterate/ExplainTable.java
index 1d5b158436..6be33aa920 100644
--- 
a/phoenix-core-client/src/main/java/org/apache/phoenix/iterate/ExplainTable.java
+++ 
b/phoenix-core-client/src/main/java/org/apache/phoenix/iterate/ExplainTable.java
@@ -361,14 +361,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);
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 588779fe36..570eeb3b3b 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
@@ -161,6 +161,8 @@ public class FlappingLocalIndexIT extends BaseLocalIndexIT {
             
             Admin admin = driver.getConnectionQueryServices(getUrl(), 
TestUtil.TEST_PROPERTIES).getAdmin();
             int numRegions = admin.getRegions(physicalTableName).size();
+            int trimmedRegionLocations = admin.getConfiguration()
+                .getInt(QueryServices.MAX_REGION_LOCATIONS_SIZE_EXPLAIN_PLAN, 
-1);
             
             String query = "SELECT * FROM " + tableName +" where v1 like 'a%'";
 
@@ -188,7 +190,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());

Reply via email to