[
https://issues.apache.org/jira/browse/PHOENIX-6400?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17294890#comment-17294890
]
ASF GitHub Bot commented on PHOENIX-6400:
-----------------------------------------
kadirozde commented on a change in pull request #1158:
URL: https://github.com/apache/phoenix/pull/1158#discussion_r586898759
##########
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:
Something like, "This exception will be caught in query enumeration in
the optimizing phase and consequently the plan will be ignored" as you wrote,
will be helpful. I will then approve it. Thanks!
----------------------------------------------------------------
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:
[email protected]
> Do no use local index with uncovered columns in the WHERE clause.
> -----------------------------------------------------------------
>
> Key: PHOENIX-6400
> URL: https://issues.apache.org/jira/browse/PHOENIX-6400
> Project: Phoenix
> Issue Type: Bug
> Reporter: Lars Hofhansl
> Assignee: Lars Hofhansl
> Priority: Blocker
> Fix For: 5.1.1, 4.16.1
>
> Attachments: 6400-5.1.txt, 6400-test-5.1.txt
>
>
> {code}
> > create table test(pk1 integer not null primary key, v1 float, v2 float, v3
> > float);
> > create local index L1 on test (v1);
> > upsert into test values(1000, 0.01, 0.1, 0.5);
> > select * from test where v1 < 0.1;
> +------+------+-----+-----+
> | PK1 | V1 | V2 | V3 |
> +------+------+-----+-----+
> | 1000 | 0.01 | 0.1 | 0.5 |
> +------+------+-----+-----+
> > select * from test where v1 < 0.1 and v2 < 10.0;
> +-----+----+----+----+
> | PK1 | V1 | V2 | V3 |
> +-----+----+----+----+
> > select /*+ NO_INDEX */ * from test where v1 < 0.1 and v2 < 10.0;
> +------+------+-----+-----+
> | PK1 | V1 | V2 | V3 |
> +------+------+-----+-----+
> | 1000 | 0.01 | 0.1 | 0.5 |
> +------+------+-----+-----+
> {code}
--
This message was sent by Atlassian Jira
(v8.3.4#803005)