You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@phoenix.apache.org by GitBox <gi...@apache.org> on 2021/03/03 23:37:34 UTC

[GitHub] [phoenix] lhofhansl commented on a change in pull request #1158: PHOENIX-6400 Do no use local index with uncovered columns in the WHERE clause.

lhofhansl commented on a change in pull request #1158:
URL: https://github.com/apache/phoenix/pull/1158#discussion_r586885373



##########
File path: phoenix-core/src/main/java/org/apache/phoenix/compile/WhereCompiler.java
##########
@@ -200,6 +201,15 @@ protected ColumnRef resolveColumn(ColumnParseNode node) throws SQLException {
                 return ref;
             }
             PTable table = ref.getTable();
+            // If current table in the context is local index and table in column reference is global that
+            // means the column is not present in the local index. Local indexes do not currently support this,
+            // so we need skip this plan.
+            if (context.getCurrentTable().getTable().getIndexType() == IndexType.LOCAL
+                    && (table.getIndexType() == null || table.getIndexType() == IndexType.GLOBAL)) {
+                String schemaNameStr = table.getSchemaName()==null?null:table.getSchemaName().getString();
+                String tableNameStr = table.getTableName()==null?null:table.getTableName().getString();
+                throw new ColumnNotFoundException(schemaNameStr, tableNameStr, null, ref.getColumn().getName().getString());

Review comment:
       I just brought that code back from before PHOENIX-5109.
   It throws an exception, which is then caught in query enumeration in the optimizing phase and consequently ignores that plan.
   Happy to add a comment to that extent.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org