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

James Taylor commented on PHOENIX-4437:
---------------------------------------

Thanks for the patch, [~maryannxue]. Here's some feedback:
- Can you add a comment here on when optimize will *not* be called? I guess 
it's not being called when you ask the plan for the estimated bytes that will 
be scanned?
{code}
+++ b/phoenix-core/src/main/java/org/apache/phoenix/jdbc/PhoenixStatement.java
@@ -581,7 +581,12 @@ public class PhoenixStatement implements Statement, 
SQLCloseable {
         @Override
         public QueryPlan compilePlan(PhoenixStatement stmt, Sequence.ValueOp 
seqAction) throws SQLException {
             CompilableStatement compilableStmt = getStatement();
-            final StatementPlan plan = compilableStmt.compilePlan(stmt, 
Sequence.ValueOp.VALIDATE_SEQUENCE);
+            StatementPlan compilePlan = compilableStmt.compilePlan(stmt, 
Sequence.ValueOp.VALIDATE_SEQUENCE);
+            if (compilePlan instanceof QueryPlan) {
+                QueryPlan dataPlan = (QueryPlan) compilePlan;
+                compilePlan = 
stmt.getConnection().getQueryServices().getOptimizer().optimize(stmt, dataPlan);
+            }
+            final StatementPlan plan = compilePlan;
{code}
- Do you think it's worth adding some tests, or do you think we have good test 
coverage from your prior check-in (and those are exercising this new code path)?

> Make QueryPlan.getEstimatedBytesToScan() independent of getExplainPlan() and 
> pull optimize() out of getExplainPlan()
> --------------------------------------------------------------------------------------------------------------------
>
>                 Key: PHOENIX-4437
>                 URL: https://issues.apache.org/jira/browse/PHOENIX-4437
>             Project: Phoenix
>          Issue Type: Improvement
>    Affects Versions: 4.11.0
>            Reporter: Maryann Xue
>            Assignee: Maryann Xue
>         Attachments: PHOENIX-4437.patch
>
>




--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Reply via email to