Skip to content

Commit

Permalink
PHOENIX-7497 ExplainPlanV2 regionserver location is not updated for l…
Browse files Browse the repository at this point in the history
…ess than max regions (#2050)
  • Loading branch information
virajjasani authored Jan 3, 2025
1 parent 3d06b7a commit 91cae25
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -378,6 +378,10 @@ private String getRegionLocationsForExplainPlan(
buf.append(originalSize);
} else {
buf.append(regionLocations);
if (explainPlanAttributesBuilder != null) {
explainPlanAttributesBuilder.setRegionLocations(
Collections.unmodifiableList(regionLocations));
}
}
buf.append(") ");
return buf.toString();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -440,6 +440,8 @@ public void testGroupByOrderPreservingDescSort() throws Exception {
explainPlanAttributes.getServerWhereFilter());
assertEquals("SERVER AGGREGATE INTO ORDERED DISTINCT ROWS BY [K1]",
explainPlanAttributes.getServerAggregate());
assertFalse("Explain plan regionLocation attribute should not be empty",
explainPlanAttributes.getRegionLocations().isEmpty());
}

@Test
Expand Down Expand Up @@ -501,6 +503,8 @@ public void testSumGroupByOrderPreservingDesc() throws Exception {
explainPlanAttributes.getServerWhereFilter());
assertEquals("SERVER AGGREGATE INTO ORDERED DISTINCT ROWS BY [K1]",
explainPlanAttributes.getServerAggregate());
assertFalse("Explain plan regionLocation attribute should not be empty",
explainPlanAttributes.getRegionLocations().isEmpty());
}

@Test
Expand Down Expand Up @@ -572,6 +576,8 @@ protected void testAvgGroupByOrderPreserving(Connection conn, String tableName,
List<KeyRange> splits = TestUtil.getAllSplits(conn, tableName);
// nGuideposts when stats are enabled, 4 when disabled
assertEquals(4, splits.size());
assertFalse("Explain plan regionLocation attribute should not be empty",
explainPlanAttributes.getRegionLocations().isEmpty());
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,8 @@ public void testIndexWithNullableFixedWithCols() throws Exception {
assertEquals("FULL SCAN ",
explainPlanAttributes.getExplainScanType());
}
assertFalse("Explain plan regionLocation attribute should not be empty",
explainPlanAttributes.getRegionLocations().isEmpty());

ResultSet rs = conn.createStatement().executeQuery(query);
assertTrue(rs.next());
Expand Down Expand Up @@ -613,6 +615,8 @@ public void testIndexWithNullableDateCol() throws Exception {
explainPlanAttributes.getTableName());
assertNull(explainPlanAttributes.getClientSortAlgo());
}
assertFalse("Explain plan regionLocation attribute should not be empty",
explainPlanAttributes.getRegionLocations().isEmpty());

ResultSet rs = conn.createStatement().executeQuery(query);
assertTrue(rs.next());
Expand Down Expand Up @@ -720,6 +724,8 @@ public void testSelectAllAndAliasWithIndex() throws Exception {
explainPlanAttributes.getTableName());
assertNull(explainPlanAttributes.getClientSortAlgo());
}
assertFalse("Explain plan regionLocation attribute should not be empty",
explainPlanAttributes.getRegionLocations().isEmpty());

rs = conn.createStatement().executeQuery(query);
assertTrue(rs.next());
Expand Down

0 comments on commit 91cae25

Please sign in to comment.