[ 
https://issues.apache.org/jira/browse/PHOENIX-3822?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16016184#comment-16016184
 ] 

James Taylor edited comment on PHOENIX-3822 at 5/18/17 6:11 PM:
----------------------------------------------------------------

Looking good, [~samarthjain]. Here's some feedback:
* Add the new methods to StatementPlan instead of QueryPlan and get rid of this 
cast. It's useful for DELETE and UPSERT SELECT queries to be able to do an 
explain and know how many bytes are scanned. It'll be pretty straightforward to 
implement - you'll essentially delegate to the QueryPlan built for these cases 
and for UPSERT VALUES and DELETE over a complete row key, and other cases like 
TRACE, etc. you'll return 0.
{code}
         public ExecutableExplainStatement(BindableStatement statement) {
@@ -496,10 +535,32 @@ public class PhoenixStatement implements Statement, 
SQLCloseable {
             final StatementPlan plan = compilableStmt.compilePlan(stmt, 
Sequence.ValueOp.VALIDATE_SEQUENCE);
             List<String> planSteps = plan.getExplainPlan().getPlanSteps();
             List<Tuple> tuples = 
Lists.newArrayListWithExpectedSize(planSteps.size());
+            Long estimatedBytesToScan = null;
+            Long estimatedRowsToScan = null;
+            if (plan instanceof QueryPlan) {
+                estimatedBytesToScan = ((QueryPlan) 
plan).getEstimatedBytesToScan();
+                estimatedRowsToScan = ((QueryPlan) 
plan).getEstimatedRowsToScan();
+            }
{code}
* How about we use slightly more descriptive names for the columns, like 
EST_BYTES_READ and EST_ROWS_READ?


was (Author: jamestaylor):
Looking good, [~samarthjain]. Here's some feedback:
* Add the new methods to StatementPlan instead of QueryPlan and get rid of this 
cast. It's useful for DELETE and UPSERT SELECT queries to be able to do an 
explain and know how many bytes are scanned. It'll be pretty straightforward to 
implement - you'll essentially delegate to the QueryPlan built for these cases 
and for UPSERT VALUES and DELETE over a complete row key, and other cases like 
TRACE, etc. you'll return 0. 
* How about we use slightly more descriptive names for the columns, like 
EST_BYTES_READ and EST_ROWS_READ?

> Surface byte and row estimates in a machine readable way when doing EXPLAIN 
> PLAN
> --------------------------------------------------------------------------------
>
>                 Key: PHOENIX-3822
>                 URL: https://issues.apache.org/jira/browse/PHOENIX-3822
>             Project: Phoenix
>          Issue Type: Improvement
>            Reporter: Samarth Jain
>            Assignee: Samarth Jain
>         Attachments: PHOENIX-3822.patch, PHOENIX-3822_v2.patch
>
>




--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

Reply via email to