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

James Taylor commented on PHOENIX-1015:
---------------------------------------

I don't think there's a reason for a local index to be used if there's no WHERE 
clause in the code below. This should be detected in QueryOptimizer. If you 
agree, would you mind tracking that down there and getting rid of this change?
{code}
Index: 
phoenix-core/src/main/java/org/apache/phoenix/compile/ProjectionCompiler.java
===================================================================
--- 
phoenix-core/src/main/java/org/apache/phoenix/compile/ProjectionCompiler.java   
    (revision 786)
+++ 
phoenix-core/src/main/java/org/apache/phoenix/compile/ProjectionCompiler.java   
    (working copy)
@@ -66,6 +66,7 @@
 import org.apache.phoenix.schema.ColumnRef;
 import org.apache.phoenix.schema.KeyValueSchema;
 import org.apache.phoenix.schema.KeyValueSchema.KeyValueSchemaBuilder;
+import org.apache.phoenix.schema.LocalIndexDataColumnRef;
 import org.apache.phoenix.schema.PColumn;
 import org.apache.phoenix.schema.PColumnFamily;
 import org.apache.phoenix.schema.PDataType;
@@ -535,6 +536,11 @@
         protected ColumnRef resolveColumn(ColumnParseNode node) throws 
SQLException {
             ColumnRef ref = super.resolveColumn(node);
             isCaseSensitive = isCaseSensitive && node.isCaseSensitive();
+            // If no where condition we need to get data columns from main 
table for each row in local index.
+            // It's like full scan of both local index and data table.
+            if (statement.getWhere() == null && ref instanceof 
LocalIndexDataColumnRef) {
+                throw new ColumnNotFoundException(node.getName());
+            }
             return ref;
         }
{code}


> Support joining back to data table row from local index when query condition 
> involves leading columns in local index
> --------------------------------------------------------------------------------------------------------------------
>
>                 Key: PHOENIX-1015
>                 URL: https://issues.apache.org/jira/browse/PHOENIX-1015
>             Project: Phoenix
>          Issue Type: Sub-task
>            Reporter: rajeshbabu
>            Assignee: rajeshbabu
>         Attachments: PHOENIX-1015.patch, PHOENIX-1015_v6.patch, 
> PHOENIX-1015_v7.patch
>
>
> When a query involves more columns to project than columns in index and query 
> condition involves leading columns in local index then first we can get 
> matching rowkeys from local index table and then get the required columns 
> from data table. In local index both data region and index region co-reside 
> in the same RS, we can call get on data region to get the missing columns in 
> the index, without any n/w overhead. So it's efficient. 



--
This message was sent by Atlassian JIRA
(v6.2#6252)

Reply via email to