Github user chrajeshbabu commented on a diff in the pull request: https://github.com/apache/phoenix/pull/3#discussion_r14897862 --- Diff: phoenix-core/src/main/java/org/apache/phoenix/compile/JoinCompiler.java --- @@ -1134,8 +1135,15 @@ public static SelectStatement optimize(PhoenixStatement statement, SelectStateme List<OrderByNode> orderBy = tableRef.equals(orderByTableRef) ? select.getOrderBy() : null; SelectStatement stmt = getSubqueryForOptimizedPlan(select.getHint(), table.getDynamicColumns(), tableRef, join.getColumnRefs(), table.getPreFiltersCombined(), groupBy, orderBy, table.isWildCardSelect()); QueryPlan plan = statement.getConnection().getQueryServices().getOptimizer().optimize(statement, stmt); + boolean localIndex = plan.getContext().getCurrentTable().getTable().getIndexType()==IndexType.LOCAL; if (!plan.getTableRef().equals(tableRef)) { - replacement.put(tableRef, plan.getTableRef()); + // Use local index plan only when all the columns to project are available in index. --- End diff -- This change is not required in the master branch James. In local-index branch join queries have failed with ColumnNotFoundException with local indexes when join query has columns other than index. So I have added the check. Currently join back from data table is not supported in join queries.
--- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---