Copilot commented on code in PR #2520:
URL: https://github.com/apache/phoenix/pull/2520#discussion_r3399567937


##########
phoenix-core-client/src/main/java/org/apache/phoenix/jdbc/PhoenixStatement.java:
##########
@@ -1018,29 +1018,35 @@ public QueryPlan compilePlan(PhoenixStatement stmt, 
Sequence.ValueOp seqAction)
       Long estimatedBytesToScan = plan.getEstimatedBytesToScan();
       Long estimatedRowsToScan = plan.getEstimatedRowsToScan();
       Long estimateInfoTimestamp = plan.getEstimateInfoTimestamp();
+      // The three estimate columns are plan totals, not per-step values. Emit 
them only on the
+      // top-of-plan. Subsequent rows carry just the plan step column.
+      boolean firstRow = true;
       for (String planStep : planSteps) {
         byte[] row = PVarchar.INSTANCE.toBytes(planStep);
         List<Cell> cells = Lists.newArrayListWithCapacity(3);
         cells.add(PhoenixKeyValueUtil.newKeyValue(row, EXPLAIN_PLAN_FAMILY, 
EXPLAIN_PLAN_COLUMN,

Review Comment:
   `cells` can contain up to 4 entries on the first row (plan step + 3 estimate 
cells), but the list is pre-sized to 3. This causes an avoidable 
resize/allocation on the common case where estimates are present.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to