[ https://issues.apache.org/jira/browse/PHOENIX-4616?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16387007#comment-16387007 ]
James Taylor commented on PHOENIX-4616: --------------------------------------- One more question: - Do you think it'd be a bit cleaner to have a QueryPlan.optimize() or getApplicablePlans() method instead of needing this instanceof check? {code} private List<QueryPlan> getApplicablePlans(QueryPlan dataPlan, PhoenixStatement statement, List<? extends PDatum> targetColumns, ParallelIteratorFactory parallelIteratorFactory, boolean stopAtBestPlan) throws SQLException { + if (!useIndexes) { + return Collections.singletonList(dataPlan); + } + + if (dataPlan instanceof BaseQueryPlan) { + return getApplicablePlans((BaseQueryPlan) dataPlan, statement, targetColumns, parallelIteratorFactory, stopAtBestPlan); + } {code} > Move join query optimization out from QueryCompiler into QueryOptimizer > ----------------------------------------------------------------------- > > Key: PHOENIX-4616 > URL: https://issues.apache.org/jira/browse/PHOENIX-4616 > Project: Phoenix > Issue Type: Improvement > Reporter: Maryann Xue > Assignee: Maryann Xue > Priority: Major > Attachments: PHOENIX-4616.patch > > > Currently we do optimization for join queries inside QueryCompiler, which > makes the APIs and code logic confusing, so we need to move join optimization > logic into QueryOptimizer. > Similarly, but probably with a different approach, we need to optimize UNION > ALL queries and derived table sub-queries in QueryOptimizer.optimize(). > Please also refer to this comment: > https://issues.apache.org/jira/browse/PHOENIX-4585?focusedCommentId=16367616&page=com.atlassian.jira.plugin.system.issuetabpanels%3Acomment-tabpanel#comment-16367616 -- This message was sent by Atlassian JIRA (v7.6.3#76005)