[jira] [Updated] (PHOENIX-5109) Allow local indexes to work for queries with uncovered columns.

2021-01-15 Thread Istvan Toth (Jira)


 [ 
https://issues.apache.org/jira/browse/PHOENIX-5109?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Istvan Toth updated PHOENIX-5109:
-
Fix Version/s: 5.1.0

> Allow local indexes to work for queries with uncovered columns.
> ---
>
> Key: PHOENIX-5109
> URL: https://issues.apache.org/jira/browse/PHOENIX-5109
> Project: Phoenix
>  Issue Type: Bug
>Affects Versions: 4.14.1
>Reporter: Lars Hofhansl
>Assignee: Lars Hofhansl
>Priority: Major
> Fix For: 4.15.0, 5.1.0
>
> Attachments: 5109-addendum.txt, 5109-addendum2.txt, 5109-v1.txt, 
> 5109-v2.txt, 5109-v3.txt, 5109-v4-master.txt
>
>
> This change allows local indexes to be used for a wide set of queries where 
> not all columns are covered.
>  See scenarios in the test case attached with the patch.
> This is important for various reasons:
>  # Unlike global indexes, local indexes can support a wide range case where 
> the queries are not covered.
>  # Indexes that cover only the indexed columns are much friendlier to schema 
> changes. (changes to any extra included column cause a need to rebuild these 
> indexes)
>  # A lot of storage is saved. The same is true for read and write IO.
> (Of course uncovered columns have disadvantages too, Phoenix needs to 
> reassemble the complete row in those cases.)
> —
> Was:
> Example:
>  {{create table test (pk integer primary key, v1 float, v2 float, v3 
> integer);}}
>  {{create local index l1 on test(v1);}}
>  {{select /*+ INDEX(test l1) */ * from test where v2 = 1;}}
> {code:java}
> 0: jdbc:phoenix:localhost> select /*+ INDEX(test l1) */ * from test where v2 
> = 1;
> Error: ERROR 504 (42703): Undefined column. columnName=TEST.V2 
> (state=42703,code=504)
> org.apache.phoenix.schema.ColumnNotFoundException: ERROR 504 (42703): 
> Undefined column. columnName=TEST.V2
>   at 
> org.apache.phoenix.compile.WhereCompiler$WhereExpressionCompiler.resolveColumn(WhereCompiler.java:202)
>   at 
> org.apache.phoenix.compile.WhereCompiler$WhereExpressionCompiler.visit(WhereCompiler.java:177)
>   at 
> org.apache.phoenix.compile.WhereCompiler$WhereExpressionCompiler.visit(WhereCompiler.java:164)
>   at 
> org.apache.phoenix.parse.ColumnParseNode.accept(ColumnParseNode.java:56)
>   at 
> org.apache.phoenix.parse.CompoundParseNode.acceptChildren(CompoundParseNode.java:64)
>   at org.apache.phoenix.parse.CastParseNode.accept(CastParseNode.java:60)
>   at 
> org.apache.phoenix.parse.CompoundParseNode.acceptChildren(CompoundParseNode.java:64)
>   at 
> org.apache.phoenix.parse.ComparisonParseNode.accept(ComparisonParseNode.java:45)
>   at 
> org.apache.phoenix.compile.WhereCompiler.compile(WhereCompiler.java:138)
>   at 
> org.apache.phoenix.compile.WhereCompiler.compile(WhereCompiler.java:108)
>   at 
> org.apache.phoenix.compile.QueryCompiler.compileSingleFlatQuery(QueryCompiler.java:559)
>   at 
> org.apache.phoenix.compile.QueryCompiler.compileSingleQuery(QueryCompiler.java:510)
>   at 
> org.apache.phoenix.compile.QueryCompiler.compileSelect(QueryCompiler.java:195)
>   at 
> org.apache.phoenix.compile.QueryCompiler.compile(QueryCompiler.java:155)
>   at 
> org.apache.phoenix.compile.QueryCompiler.compileSubquery(QueryCompiler.java:499)
>   at 
> org.apache.phoenix.compile.QueryCompiler.compileJoinQuery(QueryCompiler.java:221)
>   at 
> org.apache.phoenix.compile.QueryCompiler.compileJoinQuery(QueryCompiler.java:295)
>   at 
> org.apache.phoenix.compile.QueryCompiler.compileJoinQuery(QueryCompiler.java:230)
>   at 
> org.apache.phoenix.compile.QueryCompiler.compileSelect(QueryCompiler.java:193)
>   at 
> org.apache.phoenix.compile.QueryCompiler.compile(QueryCompiler.java:155)
>   at 
> org.apache.phoenix.optimize.QueryOptimizer.addPlan(QueryOptimizer.java:399)
>   at 
> org.apache.phoenix.optimize.QueryOptimizer.getHintedQueryPlan(QueryOptimizer.java:279)
>   at 
> org.apache.phoenix.optimize.QueryOptimizer.getApplicablePlansForSingleFlatQuery(QueryOptimizer.java:220)
>   at 
> org.apache.phoenix.optimize.QueryOptimizer.getApplicablePlans(QueryOptimizer.java:133)
>   at 
> org.apache.phoenix.optimize.QueryOptimizer.optimize(QueryOptimizer.java:111)
>   at 
> org.apache.phoenix.optimize.QueryOptimizer.optimize(QueryOptimizer.java:97)
>   at 
> org.apache.phoenix.jdbc.PhoenixStatement$1.call(PhoenixStatement.java:309)
>   at 
> org.apache.phoenix.jdbc.PhoenixStatement$1.call(PhoenixStatement.java:291)
>   at org.apache.phoenix.call.CallRunner.run(CallRunner.java:53)
>   at 
> org.apache.phoenix.jdbc.PhoenixStatement.executeQuery(PhoenixStatement.java:290)
>   at 
> org.apache.phoenix.jdbc.PhoenixStatement.executeQuery(PhoenixStatement.java:283)
>   at 
> 

[jira] [Updated] (PHOENIX-5109) Allow local indexes to work for queries with uncovered columns.

2019-01-26 Thread Lars Hofhansl (JIRA)


 [ 
https://issues.apache.org/jira/browse/PHOENIX-5109?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Lars Hofhansl updated PHOENIX-5109:
---
Attachment: 5109-addendum2.txt

> Allow local indexes to work for queries with uncovered columns.
> ---
>
> Key: PHOENIX-5109
> URL: https://issues.apache.org/jira/browse/PHOENIX-5109
> Project: Phoenix
>  Issue Type: Bug
>Affects Versions: 4.14.1
>Reporter: Lars Hofhansl
>Assignee: Lars Hofhansl
>Priority: Major
> Fix For: 4.15.0
>
> Attachments: 5109-addendum.txt, 5109-addendum2.txt, 5109-v1.txt, 
> 5109-v2.txt, 5109-v3.txt, 5109-v4-master.txt
>
>
> This change allows local indexes to be used for a wide set of queries where 
> not all columns are covered.
>  See scenarios in the test case attached with the patch.
> This is important for various reasons:
>  # Unlike global indexes, local indexes can support a wide range case where 
> the queries are not covered.
>  # Indexes that cover only the indexed columns are much friendlier to schema 
> changes. (changes to any extra included column cause a need to rebuild these 
> indexes)
>  # A lot of storage is saved. The same is true for read and write IO.
> (Of course uncovered columns have disadvantages too, Phoenix needs to 
> reassemble the complete row in those cases.)
> —
> Was:
> Example:
>  {{create table test (pk integer primary key, v1 float, v2 float, v3 
> integer);}}
>  {{create local index l1 on test(v1);}}
>  {{select /*+ INDEX(test l1) */ * from test where v2 = 1;}}
> {code:java}
> 0: jdbc:phoenix:localhost> select /*+ INDEX(test l1) */ * from test where v2 
> = 1;
> Error: ERROR 504 (42703): Undefined column. columnName=TEST.V2 
> (state=42703,code=504)
> org.apache.phoenix.schema.ColumnNotFoundException: ERROR 504 (42703): 
> Undefined column. columnName=TEST.V2
>   at 
> org.apache.phoenix.compile.WhereCompiler$WhereExpressionCompiler.resolveColumn(WhereCompiler.java:202)
>   at 
> org.apache.phoenix.compile.WhereCompiler$WhereExpressionCompiler.visit(WhereCompiler.java:177)
>   at 
> org.apache.phoenix.compile.WhereCompiler$WhereExpressionCompiler.visit(WhereCompiler.java:164)
>   at 
> org.apache.phoenix.parse.ColumnParseNode.accept(ColumnParseNode.java:56)
>   at 
> org.apache.phoenix.parse.CompoundParseNode.acceptChildren(CompoundParseNode.java:64)
>   at org.apache.phoenix.parse.CastParseNode.accept(CastParseNode.java:60)
>   at 
> org.apache.phoenix.parse.CompoundParseNode.acceptChildren(CompoundParseNode.java:64)
>   at 
> org.apache.phoenix.parse.ComparisonParseNode.accept(ComparisonParseNode.java:45)
>   at 
> org.apache.phoenix.compile.WhereCompiler.compile(WhereCompiler.java:138)
>   at 
> org.apache.phoenix.compile.WhereCompiler.compile(WhereCompiler.java:108)
>   at 
> org.apache.phoenix.compile.QueryCompiler.compileSingleFlatQuery(QueryCompiler.java:559)
>   at 
> org.apache.phoenix.compile.QueryCompiler.compileSingleQuery(QueryCompiler.java:510)
>   at 
> org.apache.phoenix.compile.QueryCompiler.compileSelect(QueryCompiler.java:195)
>   at 
> org.apache.phoenix.compile.QueryCompiler.compile(QueryCompiler.java:155)
>   at 
> org.apache.phoenix.compile.QueryCompiler.compileSubquery(QueryCompiler.java:499)
>   at 
> org.apache.phoenix.compile.QueryCompiler.compileJoinQuery(QueryCompiler.java:221)
>   at 
> org.apache.phoenix.compile.QueryCompiler.compileJoinQuery(QueryCompiler.java:295)
>   at 
> org.apache.phoenix.compile.QueryCompiler.compileJoinQuery(QueryCompiler.java:230)
>   at 
> org.apache.phoenix.compile.QueryCompiler.compileSelect(QueryCompiler.java:193)
>   at 
> org.apache.phoenix.compile.QueryCompiler.compile(QueryCompiler.java:155)
>   at 
> org.apache.phoenix.optimize.QueryOptimizer.addPlan(QueryOptimizer.java:399)
>   at 
> org.apache.phoenix.optimize.QueryOptimizer.getHintedQueryPlan(QueryOptimizer.java:279)
>   at 
> org.apache.phoenix.optimize.QueryOptimizer.getApplicablePlansForSingleFlatQuery(QueryOptimizer.java:220)
>   at 
> org.apache.phoenix.optimize.QueryOptimizer.getApplicablePlans(QueryOptimizer.java:133)
>   at 
> org.apache.phoenix.optimize.QueryOptimizer.optimize(QueryOptimizer.java:111)
>   at 
> org.apache.phoenix.optimize.QueryOptimizer.optimize(QueryOptimizer.java:97)
>   at 
> org.apache.phoenix.jdbc.PhoenixStatement$1.call(PhoenixStatement.java:309)
>   at 
> org.apache.phoenix.jdbc.PhoenixStatement$1.call(PhoenixStatement.java:291)
>   at org.apache.phoenix.call.CallRunner.run(CallRunner.java:53)
>   at 
> org.apache.phoenix.jdbc.PhoenixStatement.executeQuery(PhoenixStatement.java:290)
>   at 
> org.apache.phoenix.jdbc.PhoenixStatement.executeQuery(PhoenixStatement.java:283)
>   at 
> 

[jira] [Updated] (PHOENIX-5109) Allow local indexes to work for queries with uncovered columns.

2019-01-25 Thread Lars Hofhansl (JIRA)


 [ 
https://issues.apache.org/jira/browse/PHOENIX-5109?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Lars Hofhansl updated PHOENIX-5109:
---
Attachment: 5109-addendum.txt

> Allow local indexes to work for queries with uncovered columns.
> ---
>
> Key: PHOENIX-5109
> URL: https://issues.apache.org/jira/browse/PHOENIX-5109
> Project: Phoenix
>  Issue Type: Bug
>Affects Versions: 4.14.1
>Reporter: Lars Hofhansl
>Assignee: Lars Hofhansl
>Priority: Major
> Fix For: 4.15.0
>
> Attachments: 5109-addendum.txt, 5109-v1.txt, 5109-v2.txt, 
> 5109-v3.txt, 5109-v4-master.txt
>
>
> This change allows local indexes to be used for a wide set of queries where 
> not all columns are covered.
>  See scenarios in the test case attached with the patch.
> This is important for various reasons:
>  # Unlike global indexes, local indexes can support a wide range case where 
> the queries are not covered.
>  # Indexes that cover only the indexed columns are much friendlier to schema 
> changes. (changes to any extra included column cause a need to rebuild these 
> indexes)
>  # A lot of storage is saved. The same is true for read and write IO.
> (Of course uncovered columns have disadvantages too, Phoenix needs to 
> reassemble the complete row in those cases.)
> —
> Was:
> Example:
>  {{create table test (pk integer primary key, v1 float, v2 float, v3 
> integer);}}
>  {{create local index l1 on test(v1);}}
>  {{select /*+ INDEX(test l1) */ * from test where v2 = 1;}}
> {code:java}
> 0: jdbc:phoenix:localhost> select /*+ INDEX(test l1) */ * from test where v2 
> = 1;
> Error: ERROR 504 (42703): Undefined column. columnName=TEST.V2 
> (state=42703,code=504)
> org.apache.phoenix.schema.ColumnNotFoundException: ERROR 504 (42703): 
> Undefined column. columnName=TEST.V2
>   at 
> org.apache.phoenix.compile.WhereCompiler$WhereExpressionCompiler.resolveColumn(WhereCompiler.java:202)
>   at 
> org.apache.phoenix.compile.WhereCompiler$WhereExpressionCompiler.visit(WhereCompiler.java:177)
>   at 
> org.apache.phoenix.compile.WhereCompiler$WhereExpressionCompiler.visit(WhereCompiler.java:164)
>   at 
> org.apache.phoenix.parse.ColumnParseNode.accept(ColumnParseNode.java:56)
>   at 
> org.apache.phoenix.parse.CompoundParseNode.acceptChildren(CompoundParseNode.java:64)
>   at org.apache.phoenix.parse.CastParseNode.accept(CastParseNode.java:60)
>   at 
> org.apache.phoenix.parse.CompoundParseNode.acceptChildren(CompoundParseNode.java:64)
>   at 
> org.apache.phoenix.parse.ComparisonParseNode.accept(ComparisonParseNode.java:45)
>   at 
> org.apache.phoenix.compile.WhereCompiler.compile(WhereCompiler.java:138)
>   at 
> org.apache.phoenix.compile.WhereCompiler.compile(WhereCompiler.java:108)
>   at 
> org.apache.phoenix.compile.QueryCompiler.compileSingleFlatQuery(QueryCompiler.java:559)
>   at 
> org.apache.phoenix.compile.QueryCompiler.compileSingleQuery(QueryCompiler.java:510)
>   at 
> org.apache.phoenix.compile.QueryCompiler.compileSelect(QueryCompiler.java:195)
>   at 
> org.apache.phoenix.compile.QueryCompiler.compile(QueryCompiler.java:155)
>   at 
> org.apache.phoenix.compile.QueryCompiler.compileSubquery(QueryCompiler.java:499)
>   at 
> org.apache.phoenix.compile.QueryCompiler.compileJoinQuery(QueryCompiler.java:221)
>   at 
> org.apache.phoenix.compile.QueryCompiler.compileJoinQuery(QueryCompiler.java:295)
>   at 
> org.apache.phoenix.compile.QueryCompiler.compileJoinQuery(QueryCompiler.java:230)
>   at 
> org.apache.phoenix.compile.QueryCompiler.compileSelect(QueryCompiler.java:193)
>   at 
> org.apache.phoenix.compile.QueryCompiler.compile(QueryCompiler.java:155)
>   at 
> org.apache.phoenix.optimize.QueryOptimizer.addPlan(QueryOptimizer.java:399)
>   at 
> org.apache.phoenix.optimize.QueryOptimizer.getHintedQueryPlan(QueryOptimizer.java:279)
>   at 
> org.apache.phoenix.optimize.QueryOptimizer.getApplicablePlansForSingleFlatQuery(QueryOptimizer.java:220)
>   at 
> org.apache.phoenix.optimize.QueryOptimizer.getApplicablePlans(QueryOptimizer.java:133)
>   at 
> org.apache.phoenix.optimize.QueryOptimizer.optimize(QueryOptimizer.java:111)
>   at 
> org.apache.phoenix.optimize.QueryOptimizer.optimize(QueryOptimizer.java:97)
>   at 
> org.apache.phoenix.jdbc.PhoenixStatement$1.call(PhoenixStatement.java:309)
>   at 
> org.apache.phoenix.jdbc.PhoenixStatement$1.call(PhoenixStatement.java:291)
>   at org.apache.phoenix.call.CallRunner.run(CallRunner.java:53)
>   at 
> org.apache.phoenix.jdbc.PhoenixStatement.executeQuery(PhoenixStatement.java:290)
>   at 
> org.apache.phoenix.jdbc.PhoenixStatement.executeQuery(PhoenixStatement.java:283)
>   at 
> 

[jira] [Updated] (PHOENIX-5109) Allow local indexes to work for queries with uncovered columns.

2019-01-25 Thread Lars Hofhansl (JIRA)


 [ 
https://issues.apache.org/jira/browse/PHOENIX-5109?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Lars Hofhansl updated PHOENIX-5109:
---
Attachment: (was: 5109-addendum.txt)

> Allow local indexes to work for queries with uncovered columns.
> ---
>
> Key: PHOENIX-5109
> URL: https://issues.apache.org/jira/browse/PHOENIX-5109
> Project: Phoenix
>  Issue Type: Bug
>Affects Versions: 4.14.1
>Reporter: Lars Hofhansl
>Assignee: Lars Hofhansl
>Priority: Major
> Fix For: 4.15.0
>
> Attachments: 5109-addendum.txt, 5109-v1.txt, 5109-v2.txt, 
> 5109-v3.txt, 5109-v4-master.txt
>
>
> This change allows local indexes to be used for a wide set of queries where 
> not all columns are covered.
>  See scenarios in the test case attached with the patch.
> This is important for various reasons:
>  # Unlike global indexes, local indexes can support a wide range case where 
> the queries are not covered.
>  # Indexes that cover only the indexed columns are much friendlier to schema 
> changes. (changes to any extra included column cause a need to rebuild these 
> indexes)
>  # A lot of storage is saved. The same is true for read and write IO.
> (Of course uncovered columns have disadvantages too, Phoenix needs to 
> reassemble the complete row in those cases.)
> —
> Was:
> Example:
>  {{create table test (pk integer primary key, v1 float, v2 float, v3 
> integer);}}
>  {{create local index l1 on test(v1);}}
>  {{select /*+ INDEX(test l1) */ * from test where v2 = 1;}}
> {code:java}
> 0: jdbc:phoenix:localhost> select /*+ INDEX(test l1) */ * from test where v2 
> = 1;
> Error: ERROR 504 (42703): Undefined column. columnName=TEST.V2 
> (state=42703,code=504)
> org.apache.phoenix.schema.ColumnNotFoundException: ERROR 504 (42703): 
> Undefined column. columnName=TEST.V2
>   at 
> org.apache.phoenix.compile.WhereCompiler$WhereExpressionCompiler.resolveColumn(WhereCompiler.java:202)
>   at 
> org.apache.phoenix.compile.WhereCompiler$WhereExpressionCompiler.visit(WhereCompiler.java:177)
>   at 
> org.apache.phoenix.compile.WhereCompiler$WhereExpressionCompiler.visit(WhereCompiler.java:164)
>   at 
> org.apache.phoenix.parse.ColumnParseNode.accept(ColumnParseNode.java:56)
>   at 
> org.apache.phoenix.parse.CompoundParseNode.acceptChildren(CompoundParseNode.java:64)
>   at org.apache.phoenix.parse.CastParseNode.accept(CastParseNode.java:60)
>   at 
> org.apache.phoenix.parse.CompoundParseNode.acceptChildren(CompoundParseNode.java:64)
>   at 
> org.apache.phoenix.parse.ComparisonParseNode.accept(ComparisonParseNode.java:45)
>   at 
> org.apache.phoenix.compile.WhereCompiler.compile(WhereCompiler.java:138)
>   at 
> org.apache.phoenix.compile.WhereCompiler.compile(WhereCompiler.java:108)
>   at 
> org.apache.phoenix.compile.QueryCompiler.compileSingleFlatQuery(QueryCompiler.java:559)
>   at 
> org.apache.phoenix.compile.QueryCompiler.compileSingleQuery(QueryCompiler.java:510)
>   at 
> org.apache.phoenix.compile.QueryCompiler.compileSelect(QueryCompiler.java:195)
>   at 
> org.apache.phoenix.compile.QueryCompiler.compile(QueryCompiler.java:155)
>   at 
> org.apache.phoenix.compile.QueryCompiler.compileSubquery(QueryCompiler.java:499)
>   at 
> org.apache.phoenix.compile.QueryCompiler.compileJoinQuery(QueryCompiler.java:221)
>   at 
> org.apache.phoenix.compile.QueryCompiler.compileJoinQuery(QueryCompiler.java:295)
>   at 
> org.apache.phoenix.compile.QueryCompiler.compileJoinQuery(QueryCompiler.java:230)
>   at 
> org.apache.phoenix.compile.QueryCompiler.compileSelect(QueryCompiler.java:193)
>   at 
> org.apache.phoenix.compile.QueryCompiler.compile(QueryCompiler.java:155)
>   at 
> org.apache.phoenix.optimize.QueryOptimizer.addPlan(QueryOptimizer.java:399)
>   at 
> org.apache.phoenix.optimize.QueryOptimizer.getHintedQueryPlan(QueryOptimizer.java:279)
>   at 
> org.apache.phoenix.optimize.QueryOptimizer.getApplicablePlansForSingleFlatQuery(QueryOptimizer.java:220)
>   at 
> org.apache.phoenix.optimize.QueryOptimizer.getApplicablePlans(QueryOptimizer.java:133)
>   at 
> org.apache.phoenix.optimize.QueryOptimizer.optimize(QueryOptimizer.java:111)
>   at 
> org.apache.phoenix.optimize.QueryOptimizer.optimize(QueryOptimizer.java:97)
>   at 
> org.apache.phoenix.jdbc.PhoenixStatement$1.call(PhoenixStatement.java:309)
>   at 
> org.apache.phoenix.jdbc.PhoenixStatement$1.call(PhoenixStatement.java:291)
>   at org.apache.phoenix.call.CallRunner.run(CallRunner.java:53)
>   at 
> org.apache.phoenix.jdbc.PhoenixStatement.executeQuery(PhoenixStatement.java:290)
>   at 
> org.apache.phoenix.jdbc.PhoenixStatement.executeQuery(PhoenixStatement.java:283)
>   at 
> 

[jira] [Updated] (PHOENIX-5109) Allow local indexes to work for queries with uncovered columns.

2019-01-25 Thread Lars Hofhansl (JIRA)


 [ 
https://issues.apache.org/jira/browse/PHOENIX-5109?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Lars Hofhansl updated PHOENIX-5109:
---
Attachment: 5109-addendum.txt

> Allow local indexes to work for queries with uncovered columns.
> ---
>
> Key: PHOENIX-5109
> URL: https://issues.apache.org/jira/browse/PHOENIX-5109
> Project: Phoenix
>  Issue Type: Bug
>Affects Versions: 4.14.1
>Reporter: Lars Hofhansl
>Assignee: Lars Hofhansl
>Priority: Major
> Fix For: 4.15.0
>
> Attachments: 5109-addendum.txt, 5109-v1.txt, 5109-v2.txt, 
> 5109-v3.txt, 5109-v4-master.txt
>
>
> This change allows local indexes to be used for a wide set of queries where 
> not all columns are covered.
>  See scenarios in the test case attached with the patch.
> This is important for various reasons:
>  # Unlike global indexes, local indexes can support a wide range case where 
> the queries are not covered.
>  # Indexes that cover only the indexed columns are much friendlier to schema 
> changes. (changes to any extra included column cause a need to rebuild these 
> indexes)
>  # A lot of storage is saved. The same is true for read and write IO.
> (Of course uncovered columns have disadvantages too, Phoenix needs to 
> reassemble the complete row in those cases.)
> —
> Was:
> Example:
>  {{create table test (pk integer primary key, v1 float, v2 float, v3 
> integer);}}
>  {{create local index l1 on test(v1);}}
>  {{select /*+ INDEX(test l1) */ * from test where v2 = 1;}}
> {code:java}
> 0: jdbc:phoenix:localhost> select /*+ INDEX(test l1) */ * from test where v2 
> = 1;
> Error: ERROR 504 (42703): Undefined column. columnName=TEST.V2 
> (state=42703,code=504)
> org.apache.phoenix.schema.ColumnNotFoundException: ERROR 504 (42703): 
> Undefined column. columnName=TEST.V2
>   at 
> org.apache.phoenix.compile.WhereCompiler$WhereExpressionCompiler.resolveColumn(WhereCompiler.java:202)
>   at 
> org.apache.phoenix.compile.WhereCompiler$WhereExpressionCompiler.visit(WhereCompiler.java:177)
>   at 
> org.apache.phoenix.compile.WhereCompiler$WhereExpressionCompiler.visit(WhereCompiler.java:164)
>   at 
> org.apache.phoenix.parse.ColumnParseNode.accept(ColumnParseNode.java:56)
>   at 
> org.apache.phoenix.parse.CompoundParseNode.acceptChildren(CompoundParseNode.java:64)
>   at org.apache.phoenix.parse.CastParseNode.accept(CastParseNode.java:60)
>   at 
> org.apache.phoenix.parse.CompoundParseNode.acceptChildren(CompoundParseNode.java:64)
>   at 
> org.apache.phoenix.parse.ComparisonParseNode.accept(ComparisonParseNode.java:45)
>   at 
> org.apache.phoenix.compile.WhereCompiler.compile(WhereCompiler.java:138)
>   at 
> org.apache.phoenix.compile.WhereCompiler.compile(WhereCompiler.java:108)
>   at 
> org.apache.phoenix.compile.QueryCompiler.compileSingleFlatQuery(QueryCompiler.java:559)
>   at 
> org.apache.phoenix.compile.QueryCompiler.compileSingleQuery(QueryCompiler.java:510)
>   at 
> org.apache.phoenix.compile.QueryCompiler.compileSelect(QueryCompiler.java:195)
>   at 
> org.apache.phoenix.compile.QueryCompiler.compile(QueryCompiler.java:155)
>   at 
> org.apache.phoenix.compile.QueryCompiler.compileSubquery(QueryCompiler.java:499)
>   at 
> org.apache.phoenix.compile.QueryCompiler.compileJoinQuery(QueryCompiler.java:221)
>   at 
> org.apache.phoenix.compile.QueryCompiler.compileJoinQuery(QueryCompiler.java:295)
>   at 
> org.apache.phoenix.compile.QueryCompiler.compileJoinQuery(QueryCompiler.java:230)
>   at 
> org.apache.phoenix.compile.QueryCompiler.compileSelect(QueryCompiler.java:193)
>   at 
> org.apache.phoenix.compile.QueryCompiler.compile(QueryCompiler.java:155)
>   at 
> org.apache.phoenix.optimize.QueryOptimizer.addPlan(QueryOptimizer.java:399)
>   at 
> org.apache.phoenix.optimize.QueryOptimizer.getHintedQueryPlan(QueryOptimizer.java:279)
>   at 
> org.apache.phoenix.optimize.QueryOptimizer.getApplicablePlansForSingleFlatQuery(QueryOptimizer.java:220)
>   at 
> org.apache.phoenix.optimize.QueryOptimizer.getApplicablePlans(QueryOptimizer.java:133)
>   at 
> org.apache.phoenix.optimize.QueryOptimizer.optimize(QueryOptimizer.java:111)
>   at 
> org.apache.phoenix.optimize.QueryOptimizer.optimize(QueryOptimizer.java:97)
>   at 
> org.apache.phoenix.jdbc.PhoenixStatement$1.call(PhoenixStatement.java:309)
>   at 
> org.apache.phoenix.jdbc.PhoenixStatement$1.call(PhoenixStatement.java:291)
>   at org.apache.phoenix.call.CallRunner.run(CallRunner.java:53)
>   at 
> org.apache.phoenix.jdbc.PhoenixStatement.executeQuery(PhoenixStatement.java:290)
>   at 
> org.apache.phoenix.jdbc.PhoenixStatement.executeQuery(PhoenixStatement.java:283)
>   at 
> 

[jira] [Updated] (PHOENIX-5109) Allow local indexes to work for queries with uncovered columns.

2019-01-25 Thread Lars Hofhansl (JIRA)


 [ 
https://issues.apache.org/jira/browse/PHOENIX-5109?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Lars Hofhansl updated PHOENIX-5109:
---
Attachment: (was: 5109-addendum.txt)

> Allow local indexes to work for queries with uncovered columns.
> ---
>
> Key: PHOENIX-5109
> URL: https://issues.apache.org/jira/browse/PHOENIX-5109
> Project: Phoenix
>  Issue Type: Bug
>Affects Versions: 4.14.1
>Reporter: Lars Hofhansl
>Assignee: Lars Hofhansl
>Priority: Major
> Fix For: 4.15.0
>
> Attachments: 5109-addendum.txt, 5109-v1.txt, 5109-v2.txt, 
> 5109-v3.txt, 5109-v4-master.txt
>
>
> This change allows local indexes to be used for a wide set of queries where 
> not all columns are covered.
>  See scenarios in the test case attached with the patch.
> This is important for various reasons:
>  # Unlike global indexes, local indexes can support a wide range case where 
> the queries are not covered.
>  # Indexes that cover only the indexed columns are much friendlier to schema 
> changes. (changes to any extra included column cause a need to rebuild these 
> indexes)
>  # A lot of storage is saved. The same is true for read and write IO.
> (Of course uncovered columns have disadvantages too, Phoenix needs to 
> reassemble the complete row in those cases.)
> —
> Was:
> Example:
>  {{create table test (pk integer primary key, v1 float, v2 float, v3 
> integer);}}
>  {{create local index l1 on test(v1);}}
>  {{select /*+ INDEX(test l1) */ * from test where v2 = 1;}}
> {code:java}
> 0: jdbc:phoenix:localhost> select /*+ INDEX(test l1) */ * from test where v2 
> = 1;
> Error: ERROR 504 (42703): Undefined column. columnName=TEST.V2 
> (state=42703,code=504)
> org.apache.phoenix.schema.ColumnNotFoundException: ERROR 504 (42703): 
> Undefined column. columnName=TEST.V2
>   at 
> org.apache.phoenix.compile.WhereCompiler$WhereExpressionCompiler.resolveColumn(WhereCompiler.java:202)
>   at 
> org.apache.phoenix.compile.WhereCompiler$WhereExpressionCompiler.visit(WhereCompiler.java:177)
>   at 
> org.apache.phoenix.compile.WhereCompiler$WhereExpressionCompiler.visit(WhereCompiler.java:164)
>   at 
> org.apache.phoenix.parse.ColumnParseNode.accept(ColumnParseNode.java:56)
>   at 
> org.apache.phoenix.parse.CompoundParseNode.acceptChildren(CompoundParseNode.java:64)
>   at org.apache.phoenix.parse.CastParseNode.accept(CastParseNode.java:60)
>   at 
> org.apache.phoenix.parse.CompoundParseNode.acceptChildren(CompoundParseNode.java:64)
>   at 
> org.apache.phoenix.parse.ComparisonParseNode.accept(ComparisonParseNode.java:45)
>   at 
> org.apache.phoenix.compile.WhereCompiler.compile(WhereCompiler.java:138)
>   at 
> org.apache.phoenix.compile.WhereCompiler.compile(WhereCompiler.java:108)
>   at 
> org.apache.phoenix.compile.QueryCompiler.compileSingleFlatQuery(QueryCompiler.java:559)
>   at 
> org.apache.phoenix.compile.QueryCompiler.compileSingleQuery(QueryCompiler.java:510)
>   at 
> org.apache.phoenix.compile.QueryCompiler.compileSelect(QueryCompiler.java:195)
>   at 
> org.apache.phoenix.compile.QueryCompiler.compile(QueryCompiler.java:155)
>   at 
> org.apache.phoenix.compile.QueryCompiler.compileSubquery(QueryCompiler.java:499)
>   at 
> org.apache.phoenix.compile.QueryCompiler.compileJoinQuery(QueryCompiler.java:221)
>   at 
> org.apache.phoenix.compile.QueryCompiler.compileJoinQuery(QueryCompiler.java:295)
>   at 
> org.apache.phoenix.compile.QueryCompiler.compileJoinQuery(QueryCompiler.java:230)
>   at 
> org.apache.phoenix.compile.QueryCompiler.compileSelect(QueryCompiler.java:193)
>   at 
> org.apache.phoenix.compile.QueryCompiler.compile(QueryCompiler.java:155)
>   at 
> org.apache.phoenix.optimize.QueryOptimizer.addPlan(QueryOptimizer.java:399)
>   at 
> org.apache.phoenix.optimize.QueryOptimizer.getHintedQueryPlan(QueryOptimizer.java:279)
>   at 
> org.apache.phoenix.optimize.QueryOptimizer.getApplicablePlansForSingleFlatQuery(QueryOptimizer.java:220)
>   at 
> org.apache.phoenix.optimize.QueryOptimizer.getApplicablePlans(QueryOptimizer.java:133)
>   at 
> org.apache.phoenix.optimize.QueryOptimizer.optimize(QueryOptimizer.java:111)
>   at 
> org.apache.phoenix.optimize.QueryOptimizer.optimize(QueryOptimizer.java:97)
>   at 
> org.apache.phoenix.jdbc.PhoenixStatement$1.call(PhoenixStatement.java:309)
>   at 
> org.apache.phoenix.jdbc.PhoenixStatement$1.call(PhoenixStatement.java:291)
>   at org.apache.phoenix.call.CallRunner.run(CallRunner.java:53)
>   at 
> org.apache.phoenix.jdbc.PhoenixStatement.executeQuery(PhoenixStatement.java:290)
>   at 
> org.apache.phoenix.jdbc.PhoenixStatement.executeQuery(PhoenixStatement.java:283)
>   at 
> 

[jira] [Updated] (PHOENIX-5109) Allow local indexes to work for queries with uncovered columns.

2019-01-25 Thread Lars Hofhansl (JIRA)


 [ 
https://issues.apache.org/jira/browse/PHOENIX-5109?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Lars Hofhansl updated PHOENIX-5109:
---
Attachment: 5109-addendum.txt

> Allow local indexes to work for queries with uncovered columns.
> ---
>
> Key: PHOENIX-5109
> URL: https://issues.apache.org/jira/browse/PHOENIX-5109
> Project: Phoenix
>  Issue Type: Bug
>Affects Versions: 4.14.1
>Reporter: Lars Hofhansl
>Assignee: Lars Hofhansl
>Priority: Major
> Fix For: 4.15.0
>
> Attachments: 5109-addendum.txt, 5109-v1.txt, 5109-v2.txt, 
> 5109-v3.txt, 5109-v4-master.txt
>
>
> This change allows local indexes to be used for a wide set of queries where 
> not all columns are covered.
>  See scenarios in the test case attached with the patch.
> This is important for various reasons:
>  # Unlike global indexes, local indexes can support a wide range case where 
> the queries are not covered.
>  # Indexes that cover only the indexed columns are much friendlier to schema 
> changes. (changes to any extra included column cause a need to rebuild these 
> indexes)
>  # A lot of storage is saved. The same is true for read and write IO.
> (Of course uncovered columns have disadvantages too, Phoenix needs to 
> reassemble the complete row in those cases.)
> —
> Was:
> Example:
>  {{create table test (pk integer primary key, v1 float, v2 float, v3 
> integer);}}
>  {{create local index l1 on test(v1);}}
>  {{select /*+ INDEX(test l1) */ * from test where v2 = 1;}}
> {code:java}
> 0: jdbc:phoenix:localhost> select /*+ INDEX(test l1) */ * from test where v2 
> = 1;
> Error: ERROR 504 (42703): Undefined column. columnName=TEST.V2 
> (state=42703,code=504)
> org.apache.phoenix.schema.ColumnNotFoundException: ERROR 504 (42703): 
> Undefined column. columnName=TEST.V2
>   at 
> org.apache.phoenix.compile.WhereCompiler$WhereExpressionCompiler.resolveColumn(WhereCompiler.java:202)
>   at 
> org.apache.phoenix.compile.WhereCompiler$WhereExpressionCompiler.visit(WhereCompiler.java:177)
>   at 
> org.apache.phoenix.compile.WhereCompiler$WhereExpressionCompiler.visit(WhereCompiler.java:164)
>   at 
> org.apache.phoenix.parse.ColumnParseNode.accept(ColumnParseNode.java:56)
>   at 
> org.apache.phoenix.parse.CompoundParseNode.acceptChildren(CompoundParseNode.java:64)
>   at org.apache.phoenix.parse.CastParseNode.accept(CastParseNode.java:60)
>   at 
> org.apache.phoenix.parse.CompoundParseNode.acceptChildren(CompoundParseNode.java:64)
>   at 
> org.apache.phoenix.parse.ComparisonParseNode.accept(ComparisonParseNode.java:45)
>   at 
> org.apache.phoenix.compile.WhereCompiler.compile(WhereCompiler.java:138)
>   at 
> org.apache.phoenix.compile.WhereCompiler.compile(WhereCompiler.java:108)
>   at 
> org.apache.phoenix.compile.QueryCompiler.compileSingleFlatQuery(QueryCompiler.java:559)
>   at 
> org.apache.phoenix.compile.QueryCompiler.compileSingleQuery(QueryCompiler.java:510)
>   at 
> org.apache.phoenix.compile.QueryCompiler.compileSelect(QueryCompiler.java:195)
>   at 
> org.apache.phoenix.compile.QueryCompiler.compile(QueryCompiler.java:155)
>   at 
> org.apache.phoenix.compile.QueryCompiler.compileSubquery(QueryCompiler.java:499)
>   at 
> org.apache.phoenix.compile.QueryCompiler.compileJoinQuery(QueryCompiler.java:221)
>   at 
> org.apache.phoenix.compile.QueryCompiler.compileJoinQuery(QueryCompiler.java:295)
>   at 
> org.apache.phoenix.compile.QueryCompiler.compileJoinQuery(QueryCompiler.java:230)
>   at 
> org.apache.phoenix.compile.QueryCompiler.compileSelect(QueryCompiler.java:193)
>   at 
> org.apache.phoenix.compile.QueryCompiler.compile(QueryCompiler.java:155)
>   at 
> org.apache.phoenix.optimize.QueryOptimizer.addPlan(QueryOptimizer.java:399)
>   at 
> org.apache.phoenix.optimize.QueryOptimizer.getHintedQueryPlan(QueryOptimizer.java:279)
>   at 
> org.apache.phoenix.optimize.QueryOptimizer.getApplicablePlansForSingleFlatQuery(QueryOptimizer.java:220)
>   at 
> org.apache.phoenix.optimize.QueryOptimizer.getApplicablePlans(QueryOptimizer.java:133)
>   at 
> org.apache.phoenix.optimize.QueryOptimizer.optimize(QueryOptimizer.java:111)
>   at 
> org.apache.phoenix.optimize.QueryOptimizer.optimize(QueryOptimizer.java:97)
>   at 
> org.apache.phoenix.jdbc.PhoenixStatement$1.call(PhoenixStatement.java:309)
>   at 
> org.apache.phoenix.jdbc.PhoenixStatement$1.call(PhoenixStatement.java:291)
>   at org.apache.phoenix.call.CallRunner.run(CallRunner.java:53)
>   at 
> org.apache.phoenix.jdbc.PhoenixStatement.executeQuery(PhoenixStatement.java:290)
>   at 
> org.apache.phoenix.jdbc.PhoenixStatement.executeQuery(PhoenixStatement.java:283)
>   at 
> 

[jira] [Updated] (PHOENIX-5109) Allow local indexes to work for queries with uncovered columns.

2019-01-25 Thread Lars Hofhansl (JIRA)


 [ 
https://issues.apache.org/jira/browse/PHOENIX-5109?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Lars Hofhansl updated PHOENIX-5109:
---
Attachment: (was: 5109-addendum.txt)

> Allow local indexes to work for queries with uncovered columns.
> ---
>
> Key: PHOENIX-5109
> URL: https://issues.apache.org/jira/browse/PHOENIX-5109
> Project: Phoenix
>  Issue Type: Bug
>Affects Versions: 4.14.1
>Reporter: Lars Hofhansl
>Assignee: Lars Hofhansl
>Priority: Major
> Fix For: 4.15.0
>
> Attachments: 5109-addendum.txt, 5109-v1.txt, 5109-v2.txt, 
> 5109-v3.txt, 5109-v4-master.txt
>
>
> This change allows local indexes to be used for a wide set of queries where 
> not all columns are covered.
>  See scenarios in the test case attached with the patch.
> This is important for various reasons:
>  # Unlike global indexes, local indexes can support a wide range case where 
> the queries are not covered.
>  # Indexes that cover only the indexed columns are much friendlier to schema 
> changes. (changes to any extra included column cause a need to rebuild these 
> indexes)
>  # A lot of storage is saved. The same is true for read and write IO.
> (Of course uncovered columns have disadvantages too, Phoenix needs to 
> reassemble the complete row in those cases.)
> —
> Was:
> Example:
>  {{create table test (pk integer primary key, v1 float, v2 float, v3 
> integer);}}
>  {{create local index l1 on test(v1);}}
>  {{select /*+ INDEX(test l1) */ * from test where v2 = 1;}}
> {code:java}
> 0: jdbc:phoenix:localhost> select /*+ INDEX(test l1) */ * from test where v2 
> = 1;
> Error: ERROR 504 (42703): Undefined column. columnName=TEST.V2 
> (state=42703,code=504)
> org.apache.phoenix.schema.ColumnNotFoundException: ERROR 504 (42703): 
> Undefined column. columnName=TEST.V2
>   at 
> org.apache.phoenix.compile.WhereCompiler$WhereExpressionCompiler.resolveColumn(WhereCompiler.java:202)
>   at 
> org.apache.phoenix.compile.WhereCompiler$WhereExpressionCompiler.visit(WhereCompiler.java:177)
>   at 
> org.apache.phoenix.compile.WhereCompiler$WhereExpressionCompiler.visit(WhereCompiler.java:164)
>   at 
> org.apache.phoenix.parse.ColumnParseNode.accept(ColumnParseNode.java:56)
>   at 
> org.apache.phoenix.parse.CompoundParseNode.acceptChildren(CompoundParseNode.java:64)
>   at org.apache.phoenix.parse.CastParseNode.accept(CastParseNode.java:60)
>   at 
> org.apache.phoenix.parse.CompoundParseNode.acceptChildren(CompoundParseNode.java:64)
>   at 
> org.apache.phoenix.parse.ComparisonParseNode.accept(ComparisonParseNode.java:45)
>   at 
> org.apache.phoenix.compile.WhereCompiler.compile(WhereCompiler.java:138)
>   at 
> org.apache.phoenix.compile.WhereCompiler.compile(WhereCompiler.java:108)
>   at 
> org.apache.phoenix.compile.QueryCompiler.compileSingleFlatQuery(QueryCompiler.java:559)
>   at 
> org.apache.phoenix.compile.QueryCompiler.compileSingleQuery(QueryCompiler.java:510)
>   at 
> org.apache.phoenix.compile.QueryCompiler.compileSelect(QueryCompiler.java:195)
>   at 
> org.apache.phoenix.compile.QueryCompiler.compile(QueryCompiler.java:155)
>   at 
> org.apache.phoenix.compile.QueryCompiler.compileSubquery(QueryCompiler.java:499)
>   at 
> org.apache.phoenix.compile.QueryCompiler.compileJoinQuery(QueryCompiler.java:221)
>   at 
> org.apache.phoenix.compile.QueryCompiler.compileJoinQuery(QueryCompiler.java:295)
>   at 
> org.apache.phoenix.compile.QueryCompiler.compileJoinQuery(QueryCompiler.java:230)
>   at 
> org.apache.phoenix.compile.QueryCompiler.compileSelect(QueryCompiler.java:193)
>   at 
> org.apache.phoenix.compile.QueryCompiler.compile(QueryCompiler.java:155)
>   at 
> org.apache.phoenix.optimize.QueryOptimizer.addPlan(QueryOptimizer.java:399)
>   at 
> org.apache.phoenix.optimize.QueryOptimizer.getHintedQueryPlan(QueryOptimizer.java:279)
>   at 
> org.apache.phoenix.optimize.QueryOptimizer.getApplicablePlansForSingleFlatQuery(QueryOptimizer.java:220)
>   at 
> org.apache.phoenix.optimize.QueryOptimizer.getApplicablePlans(QueryOptimizer.java:133)
>   at 
> org.apache.phoenix.optimize.QueryOptimizer.optimize(QueryOptimizer.java:111)
>   at 
> org.apache.phoenix.optimize.QueryOptimizer.optimize(QueryOptimizer.java:97)
>   at 
> org.apache.phoenix.jdbc.PhoenixStatement$1.call(PhoenixStatement.java:309)
>   at 
> org.apache.phoenix.jdbc.PhoenixStatement$1.call(PhoenixStatement.java:291)
>   at org.apache.phoenix.call.CallRunner.run(CallRunner.java:53)
>   at 
> org.apache.phoenix.jdbc.PhoenixStatement.executeQuery(PhoenixStatement.java:290)
>   at 
> org.apache.phoenix.jdbc.PhoenixStatement.executeQuery(PhoenixStatement.java:283)
>   at 
> 

[jira] [Updated] (PHOENIX-5109) Allow local indexes to work for queries with uncovered columns.

2019-01-25 Thread Lars Hofhansl (JIRA)


 [ 
https://issues.apache.org/jira/browse/PHOENIX-5109?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Lars Hofhansl updated PHOENIX-5109:
---
Attachment: 5109-addendum.txt

> Allow local indexes to work for queries with uncovered columns.
> ---
>
> Key: PHOENIX-5109
> URL: https://issues.apache.org/jira/browse/PHOENIX-5109
> Project: Phoenix
>  Issue Type: Bug
>Affects Versions: 4.14.1
>Reporter: Lars Hofhansl
>Assignee: Lars Hofhansl
>Priority: Major
> Fix For: 4.15.0
>
> Attachments: 5109-addendum.txt, 5109-v1.txt, 5109-v2.txt, 
> 5109-v3.txt, 5109-v4-master.txt
>
>
> This change allows local indexes to be used for a wide set of queries where 
> not all columns are covered.
>  See scenarios in the test case attached with the patch.
> This is important for various reasons:
>  # Unlike global indexes, local indexes can support a wide range case where 
> the queries are not covered.
>  # Indexes that cover only the indexed columns are much friendlier to schema 
> changes. (changes to any extra included column cause a need to rebuild these 
> indexes)
>  # A lot of storage is saved. The same is true for read and write IO.
> (Of course uncovered columns have disadvantages too, Phoenix needs to 
> reassemble the complete row in those cases.)
> —
> Was:
> Example:
>  {{create table test (pk integer primary key, v1 float, v2 float, v3 
> integer);}}
>  {{create local index l1 on test(v1);}}
>  {{select /*+ INDEX(test l1) */ * from test where v2 = 1;}}
> {code:java}
> 0: jdbc:phoenix:localhost> select /*+ INDEX(test l1) */ * from test where v2 
> = 1;
> Error: ERROR 504 (42703): Undefined column. columnName=TEST.V2 
> (state=42703,code=504)
> org.apache.phoenix.schema.ColumnNotFoundException: ERROR 504 (42703): 
> Undefined column. columnName=TEST.V2
>   at 
> org.apache.phoenix.compile.WhereCompiler$WhereExpressionCompiler.resolveColumn(WhereCompiler.java:202)
>   at 
> org.apache.phoenix.compile.WhereCompiler$WhereExpressionCompiler.visit(WhereCompiler.java:177)
>   at 
> org.apache.phoenix.compile.WhereCompiler$WhereExpressionCompiler.visit(WhereCompiler.java:164)
>   at 
> org.apache.phoenix.parse.ColumnParseNode.accept(ColumnParseNode.java:56)
>   at 
> org.apache.phoenix.parse.CompoundParseNode.acceptChildren(CompoundParseNode.java:64)
>   at org.apache.phoenix.parse.CastParseNode.accept(CastParseNode.java:60)
>   at 
> org.apache.phoenix.parse.CompoundParseNode.acceptChildren(CompoundParseNode.java:64)
>   at 
> org.apache.phoenix.parse.ComparisonParseNode.accept(ComparisonParseNode.java:45)
>   at 
> org.apache.phoenix.compile.WhereCompiler.compile(WhereCompiler.java:138)
>   at 
> org.apache.phoenix.compile.WhereCompiler.compile(WhereCompiler.java:108)
>   at 
> org.apache.phoenix.compile.QueryCompiler.compileSingleFlatQuery(QueryCompiler.java:559)
>   at 
> org.apache.phoenix.compile.QueryCompiler.compileSingleQuery(QueryCompiler.java:510)
>   at 
> org.apache.phoenix.compile.QueryCompiler.compileSelect(QueryCompiler.java:195)
>   at 
> org.apache.phoenix.compile.QueryCompiler.compile(QueryCompiler.java:155)
>   at 
> org.apache.phoenix.compile.QueryCompiler.compileSubquery(QueryCompiler.java:499)
>   at 
> org.apache.phoenix.compile.QueryCompiler.compileJoinQuery(QueryCompiler.java:221)
>   at 
> org.apache.phoenix.compile.QueryCompiler.compileJoinQuery(QueryCompiler.java:295)
>   at 
> org.apache.phoenix.compile.QueryCompiler.compileJoinQuery(QueryCompiler.java:230)
>   at 
> org.apache.phoenix.compile.QueryCompiler.compileSelect(QueryCompiler.java:193)
>   at 
> org.apache.phoenix.compile.QueryCompiler.compile(QueryCompiler.java:155)
>   at 
> org.apache.phoenix.optimize.QueryOptimizer.addPlan(QueryOptimizer.java:399)
>   at 
> org.apache.phoenix.optimize.QueryOptimizer.getHintedQueryPlan(QueryOptimizer.java:279)
>   at 
> org.apache.phoenix.optimize.QueryOptimizer.getApplicablePlansForSingleFlatQuery(QueryOptimizer.java:220)
>   at 
> org.apache.phoenix.optimize.QueryOptimizer.getApplicablePlans(QueryOptimizer.java:133)
>   at 
> org.apache.phoenix.optimize.QueryOptimizer.optimize(QueryOptimizer.java:111)
>   at 
> org.apache.phoenix.optimize.QueryOptimizer.optimize(QueryOptimizer.java:97)
>   at 
> org.apache.phoenix.jdbc.PhoenixStatement$1.call(PhoenixStatement.java:309)
>   at 
> org.apache.phoenix.jdbc.PhoenixStatement$1.call(PhoenixStatement.java:291)
>   at org.apache.phoenix.call.CallRunner.run(CallRunner.java:53)
>   at 
> org.apache.phoenix.jdbc.PhoenixStatement.executeQuery(PhoenixStatement.java:290)
>   at 
> org.apache.phoenix.jdbc.PhoenixStatement.executeQuery(PhoenixStatement.java:283)
>   at 
> 

[jira] [Updated] (PHOENIX-5109) Allow local indexes to work for queries with uncovered columns.

2019-01-25 Thread Lars Hofhansl (JIRA)


 [ 
https://issues.apache.org/jira/browse/PHOENIX-5109?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Lars Hofhansl updated PHOENIX-5109:
---
Attachment: (was: 5109-addendum.txt)

> Allow local indexes to work for queries with uncovered columns.
> ---
>
> Key: PHOENIX-5109
> URL: https://issues.apache.org/jira/browse/PHOENIX-5109
> Project: Phoenix
>  Issue Type: Bug
>Affects Versions: 4.14.1
>Reporter: Lars Hofhansl
>Assignee: Lars Hofhansl
>Priority: Major
> Fix For: 4.15.0
>
> Attachments: 5109-addendum.txt, 5109-v1.txt, 5109-v2.txt, 
> 5109-v3.txt, 5109-v4-master.txt
>
>
> This change allows local indexes to be used for a wide set of queries where 
> not all columns are covered.
>  See scenarios in the test case attached with the patch.
> This is important for various reasons:
>  # Unlike global indexes, local indexes can support a wide range case where 
> the queries are not covered.
>  # Indexes that cover only the indexed columns are much friendlier to schema 
> changes. (changes to any extra included column cause a need to rebuild these 
> indexes)
>  # A lot of storage is saved. The same is true for read and write IO.
> (Of course uncovered columns have disadvantages too, Phoenix needs to 
> reassemble the complete row in those cases.)
> —
> Was:
> Example:
>  {{create table test (pk integer primary key, v1 float, v2 float, v3 
> integer);}}
>  {{create local index l1 on test(v1);}}
>  {{select /*+ INDEX(test l1) */ * from test where v2 = 1;}}
> {code:java}
> 0: jdbc:phoenix:localhost> select /*+ INDEX(test l1) */ * from test where v2 
> = 1;
> Error: ERROR 504 (42703): Undefined column. columnName=TEST.V2 
> (state=42703,code=504)
> org.apache.phoenix.schema.ColumnNotFoundException: ERROR 504 (42703): 
> Undefined column. columnName=TEST.V2
>   at 
> org.apache.phoenix.compile.WhereCompiler$WhereExpressionCompiler.resolveColumn(WhereCompiler.java:202)
>   at 
> org.apache.phoenix.compile.WhereCompiler$WhereExpressionCompiler.visit(WhereCompiler.java:177)
>   at 
> org.apache.phoenix.compile.WhereCompiler$WhereExpressionCompiler.visit(WhereCompiler.java:164)
>   at 
> org.apache.phoenix.parse.ColumnParseNode.accept(ColumnParseNode.java:56)
>   at 
> org.apache.phoenix.parse.CompoundParseNode.acceptChildren(CompoundParseNode.java:64)
>   at org.apache.phoenix.parse.CastParseNode.accept(CastParseNode.java:60)
>   at 
> org.apache.phoenix.parse.CompoundParseNode.acceptChildren(CompoundParseNode.java:64)
>   at 
> org.apache.phoenix.parse.ComparisonParseNode.accept(ComparisonParseNode.java:45)
>   at 
> org.apache.phoenix.compile.WhereCompiler.compile(WhereCompiler.java:138)
>   at 
> org.apache.phoenix.compile.WhereCompiler.compile(WhereCompiler.java:108)
>   at 
> org.apache.phoenix.compile.QueryCompiler.compileSingleFlatQuery(QueryCompiler.java:559)
>   at 
> org.apache.phoenix.compile.QueryCompiler.compileSingleQuery(QueryCompiler.java:510)
>   at 
> org.apache.phoenix.compile.QueryCompiler.compileSelect(QueryCompiler.java:195)
>   at 
> org.apache.phoenix.compile.QueryCompiler.compile(QueryCompiler.java:155)
>   at 
> org.apache.phoenix.compile.QueryCompiler.compileSubquery(QueryCompiler.java:499)
>   at 
> org.apache.phoenix.compile.QueryCompiler.compileJoinQuery(QueryCompiler.java:221)
>   at 
> org.apache.phoenix.compile.QueryCompiler.compileJoinQuery(QueryCompiler.java:295)
>   at 
> org.apache.phoenix.compile.QueryCompiler.compileJoinQuery(QueryCompiler.java:230)
>   at 
> org.apache.phoenix.compile.QueryCompiler.compileSelect(QueryCompiler.java:193)
>   at 
> org.apache.phoenix.compile.QueryCompiler.compile(QueryCompiler.java:155)
>   at 
> org.apache.phoenix.optimize.QueryOptimizer.addPlan(QueryOptimizer.java:399)
>   at 
> org.apache.phoenix.optimize.QueryOptimizer.getHintedQueryPlan(QueryOptimizer.java:279)
>   at 
> org.apache.phoenix.optimize.QueryOptimizer.getApplicablePlansForSingleFlatQuery(QueryOptimizer.java:220)
>   at 
> org.apache.phoenix.optimize.QueryOptimizer.getApplicablePlans(QueryOptimizer.java:133)
>   at 
> org.apache.phoenix.optimize.QueryOptimizer.optimize(QueryOptimizer.java:111)
>   at 
> org.apache.phoenix.optimize.QueryOptimizer.optimize(QueryOptimizer.java:97)
>   at 
> org.apache.phoenix.jdbc.PhoenixStatement$1.call(PhoenixStatement.java:309)
>   at 
> org.apache.phoenix.jdbc.PhoenixStatement$1.call(PhoenixStatement.java:291)
>   at org.apache.phoenix.call.CallRunner.run(CallRunner.java:53)
>   at 
> org.apache.phoenix.jdbc.PhoenixStatement.executeQuery(PhoenixStatement.java:290)
>   at 
> org.apache.phoenix.jdbc.PhoenixStatement.executeQuery(PhoenixStatement.java:283)
>   at 
> 

[jira] [Updated] (PHOENIX-5109) Allow local indexes to work for queries with uncovered columns.

2019-01-24 Thread Lars Hofhansl (JIRA)


 [ 
https://issues.apache.org/jira/browse/PHOENIX-5109?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Lars Hofhansl updated PHOENIX-5109:
---
Attachment: 5109-addendum.txt

> Allow local indexes to work for queries with uncovered columns.
> ---
>
> Key: PHOENIX-5109
> URL: https://issues.apache.org/jira/browse/PHOENIX-5109
> Project: Phoenix
>  Issue Type: Bug
>Affects Versions: 4.14.1
>Reporter: Lars Hofhansl
>Assignee: Lars Hofhansl
>Priority: Major
> Fix For: 4.15.0
>
> Attachments: 5109-addendum.txt, 5109-v1.txt, 5109-v2.txt, 
> 5109-v3.txt, 5109-v4-master.txt
>
>
> This change allows local indexes to be used for a wide set of queries where 
> not all columns are covered.
>  See scenarios in the test case attached with the patch.
> This is important for various reasons:
>  # Unlike global indexes, local indexes can support a wide range case where 
> the queries are not covered.
>  # Indexes that cover only the indexed columns are much friendlier to schema 
> changes. (changes to any extra included column cause a need to rebuild these 
> indexes)
>  # A lot of storage is saved. The same is true for read and write IO.
> (Of course uncovered columns have disadvantages too, Phoenix needs to 
> reassemble the complete row in those cases.)
> —
> Was:
> Example:
>  {{create table test (pk integer primary key, v1 float, v2 float, v3 
> integer);}}
>  {{create local index l1 on test(v1);}}
>  {{select /*+ INDEX(test l1) */ * from test where v2 = 1;}}
> {code:java}
> 0: jdbc:phoenix:localhost> select /*+ INDEX(test l1) */ * from test where v2 
> = 1;
> Error: ERROR 504 (42703): Undefined column. columnName=TEST.V2 
> (state=42703,code=504)
> org.apache.phoenix.schema.ColumnNotFoundException: ERROR 504 (42703): 
> Undefined column. columnName=TEST.V2
>   at 
> org.apache.phoenix.compile.WhereCompiler$WhereExpressionCompiler.resolveColumn(WhereCompiler.java:202)
>   at 
> org.apache.phoenix.compile.WhereCompiler$WhereExpressionCompiler.visit(WhereCompiler.java:177)
>   at 
> org.apache.phoenix.compile.WhereCompiler$WhereExpressionCompiler.visit(WhereCompiler.java:164)
>   at 
> org.apache.phoenix.parse.ColumnParseNode.accept(ColumnParseNode.java:56)
>   at 
> org.apache.phoenix.parse.CompoundParseNode.acceptChildren(CompoundParseNode.java:64)
>   at org.apache.phoenix.parse.CastParseNode.accept(CastParseNode.java:60)
>   at 
> org.apache.phoenix.parse.CompoundParseNode.acceptChildren(CompoundParseNode.java:64)
>   at 
> org.apache.phoenix.parse.ComparisonParseNode.accept(ComparisonParseNode.java:45)
>   at 
> org.apache.phoenix.compile.WhereCompiler.compile(WhereCompiler.java:138)
>   at 
> org.apache.phoenix.compile.WhereCompiler.compile(WhereCompiler.java:108)
>   at 
> org.apache.phoenix.compile.QueryCompiler.compileSingleFlatQuery(QueryCompiler.java:559)
>   at 
> org.apache.phoenix.compile.QueryCompiler.compileSingleQuery(QueryCompiler.java:510)
>   at 
> org.apache.phoenix.compile.QueryCompiler.compileSelect(QueryCompiler.java:195)
>   at 
> org.apache.phoenix.compile.QueryCompiler.compile(QueryCompiler.java:155)
>   at 
> org.apache.phoenix.compile.QueryCompiler.compileSubquery(QueryCompiler.java:499)
>   at 
> org.apache.phoenix.compile.QueryCompiler.compileJoinQuery(QueryCompiler.java:221)
>   at 
> org.apache.phoenix.compile.QueryCompiler.compileJoinQuery(QueryCompiler.java:295)
>   at 
> org.apache.phoenix.compile.QueryCompiler.compileJoinQuery(QueryCompiler.java:230)
>   at 
> org.apache.phoenix.compile.QueryCompiler.compileSelect(QueryCompiler.java:193)
>   at 
> org.apache.phoenix.compile.QueryCompiler.compile(QueryCompiler.java:155)
>   at 
> org.apache.phoenix.optimize.QueryOptimizer.addPlan(QueryOptimizer.java:399)
>   at 
> org.apache.phoenix.optimize.QueryOptimizer.getHintedQueryPlan(QueryOptimizer.java:279)
>   at 
> org.apache.phoenix.optimize.QueryOptimizer.getApplicablePlansForSingleFlatQuery(QueryOptimizer.java:220)
>   at 
> org.apache.phoenix.optimize.QueryOptimizer.getApplicablePlans(QueryOptimizer.java:133)
>   at 
> org.apache.phoenix.optimize.QueryOptimizer.optimize(QueryOptimizer.java:111)
>   at 
> org.apache.phoenix.optimize.QueryOptimizer.optimize(QueryOptimizer.java:97)
>   at 
> org.apache.phoenix.jdbc.PhoenixStatement$1.call(PhoenixStatement.java:309)
>   at 
> org.apache.phoenix.jdbc.PhoenixStatement$1.call(PhoenixStatement.java:291)
>   at org.apache.phoenix.call.CallRunner.run(CallRunner.java:53)
>   at 
> org.apache.phoenix.jdbc.PhoenixStatement.executeQuery(PhoenixStatement.java:290)
>   at 
> org.apache.phoenix.jdbc.PhoenixStatement.executeQuery(PhoenixStatement.java:283)
>   at 
> 

[jira] [Updated] (PHOENIX-5109) Allow local indexes to work for queries with uncovered columns.

2019-01-24 Thread Lars Hofhansl (JIRA)


 [ 
https://issues.apache.org/jira/browse/PHOENIX-5109?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Lars Hofhansl updated PHOENIX-5109:
---
Description: 
This change allows local indexes to be used for a wide set of queries where not 
all columns are covered.
 See scenarios in the test case attached with the patch.

This is important for various reasons:
 # Unlike global indexes, local indexes can support a wide range case where the 
queries are not covered.
 # Indexes that cover only the indexed columns are much friendlier to schema 
changes. (changes to any extra included column cause a need to rebuild these 
indexes)
 # A lot of storage is saved. The same is true for read and write IO.

(Of course uncovered columns have disadvantages too, Phoenix needs to 
reassemble the complete row in those cases.)

—

Was:

Example:
 {{create table test (pk integer primary key, v1 float, v2 float, v3 integer);}}
 {{create local index l1 on test(v1);}}
 {{select /*+ INDEX(test l1) */ * from test where v2 = 1;}}
{code:java}
0: jdbc:phoenix:localhost> select /*+ INDEX(test l1) */ * from test where v2 = 
1;
Error: ERROR 504 (42703): Undefined column. columnName=TEST.V2 
(state=42703,code=504)
org.apache.phoenix.schema.ColumnNotFoundException: ERROR 504 (42703): Undefined 
column. columnName=TEST.V2
at 
org.apache.phoenix.compile.WhereCompiler$WhereExpressionCompiler.resolveColumn(WhereCompiler.java:202)
at 
org.apache.phoenix.compile.WhereCompiler$WhereExpressionCompiler.visit(WhereCompiler.java:177)
at 
org.apache.phoenix.compile.WhereCompiler$WhereExpressionCompiler.visit(WhereCompiler.java:164)
at 
org.apache.phoenix.parse.ColumnParseNode.accept(ColumnParseNode.java:56)
at 
org.apache.phoenix.parse.CompoundParseNode.acceptChildren(CompoundParseNode.java:64)
at org.apache.phoenix.parse.CastParseNode.accept(CastParseNode.java:60)
at 
org.apache.phoenix.parse.CompoundParseNode.acceptChildren(CompoundParseNode.java:64)
at 
org.apache.phoenix.parse.ComparisonParseNode.accept(ComparisonParseNode.java:45)
at 
org.apache.phoenix.compile.WhereCompiler.compile(WhereCompiler.java:138)
at 
org.apache.phoenix.compile.WhereCompiler.compile(WhereCompiler.java:108)
at 
org.apache.phoenix.compile.QueryCompiler.compileSingleFlatQuery(QueryCompiler.java:559)
at 
org.apache.phoenix.compile.QueryCompiler.compileSingleQuery(QueryCompiler.java:510)
at 
org.apache.phoenix.compile.QueryCompiler.compileSelect(QueryCompiler.java:195)
at 
org.apache.phoenix.compile.QueryCompiler.compile(QueryCompiler.java:155)
at 
org.apache.phoenix.compile.QueryCompiler.compileSubquery(QueryCompiler.java:499)
at 
org.apache.phoenix.compile.QueryCompiler.compileJoinQuery(QueryCompiler.java:221)
at 
org.apache.phoenix.compile.QueryCompiler.compileJoinQuery(QueryCompiler.java:295)
at 
org.apache.phoenix.compile.QueryCompiler.compileJoinQuery(QueryCompiler.java:230)
at 
org.apache.phoenix.compile.QueryCompiler.compileSelect(QueryCompiler.java:193)
at 
org.apache.phoenix.compile.QueryCompiler.compile(QueryCompiler.java:155)
at 
org.apache.phoenix.optimize.QueryOptimizer.addPlan(QueryOptimizer.java:399)
at 
org.apache.phoenix.optimize.QueryOptimizer.getHintedQueryPlan(QueryOptimizer.java:279)
at 
org.apache.phoenix.optimize.QueryOptimizer.getApplicablePlansForSingleFlatQuery(QueryOptimizer.java:220)
at 
org.apache.phoenix.optimize.QueryOptimizer.getApplicablePlans(QueryOptimizer.java:133)
at 
org.apache.phoenix.optimize.QueryOptimizer.optimize(QueryOptimizer.java:111)
at 
org.apache.phoenix.optimize.QueryOptimizer.optimize(QueryOptimizer.java:97)
at 
org.apache.phoenix.jdbc.PhoenixStatement$1.call(PhoenixStatement.java:309)
at 
org.apache.phoenix.jdbc.PhoenixStatement$1.call(PhoenixStatement.java:291)
at org.apache.phoenix.call.CallRunner.run(CallRunner.java:53)
at 
org.apache.phoenix.jdbc.PhoenixStatement.executeQuery(PhoenixStatement.java:290)
at 
org.apache.phoenix.jdbc.PhoenixStatement.executeQuery(PhoenixStatement.java:283)
at 
org.apache.phoenix.jdbc.PhoenixStatement.execute(PhoenixStatement.java:1830)
at sqlline.Commands.execute(Commands.java:822)
at sqlline.Commands.sql(Commands.java:732)
at sqlline.SqlLine.dispatch(SqlLine.java:813)
at sqlline.SqlLine.begin(SqlLine.java:686)
at sqlline.SqlLine.start(SqlLine.java:398)
at sqlline.SqlLine.main(SqlLine.java:291)
{code}

  was:
This change allows local indexes to be used for a wide set of queries where not 
all columns are covered.
See scenarios in the test case attached with the patch.

---

Was:

Example:
{{create table test (pk integer primary key, v1 float, v2 float, v3 integer);}}
{{create local index l1 on test(v1);}}
{{select /*+ INDEX(test 

[jira] [Updated] (PHOENIX-5109) Allow local indexes to work for queries with uncovered columns.

2019-01-24 Thread Lars Hofhansl (JIRA)


 [ 
https://issues.apache.org/jira/browse/PHOENIX-5109?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Lars Hofhansl updated PHOENIX-5109:
---
Description: 
This change allows local indexes to be used for a wide set of queries where not 
all columns are covered.
See scenarios in the test case attached with the patch.

---

Was:

Example:
{{create table test (pk integer primary key, v1 float, v2 float, v3 integer);}}
{{create local index l1 on test(v1);}}
{{select /*+ INDEX(test l1) */ * from test where v2 = 1;}}

{code}
0: jdbc:phoenix:localhost> select /*+ INDEX(test l1) */ * from test where v2 = 
1;
Error: ERROR 504 (42703): Undefined column. columnName=TEST.V2 
(state=42703,code=504)
org.apache.phoenix.schema.ColumnNotFoundException: ERROR 504 (42703): Undefined 
column. columnName=TEST.V2
at 
org.apache.phoenix.compile.WhereCompiler$WhereExpressionCompiler.resolveColumn(WhereCompiler.java:202)
at 
org.apache.phoenix.compile.WhereCompiler$WhereExpressionCompiler.visit(WhereCompiler.java:177)
at 
org.apache.phoenix.compile.WhereCompiler$WhereExpressionCompiler.visit(WhereCompiler.java:164)
at 
org.apache.phoenix.parse.ColumnParseNode.accept(ColumnParseNode.java:56)
at 
org.apache.phoenix.parse.CompoundParseNode.acceptChildren(CompoundParseNode.java:64)
at org.apache.phoenix.parse.CastParseNode.accept(CastParseNode.java:60)
at 
org.apache.phoenix.parse.CompoundParseNode.acceptChildren(CompoundParseNode.java:64)
at 
org.apache.phoenix.parse.ComparisonParseNode.accept(ComparisonParseNode.java:45)
at 
org.apache.phoenix.compile.WhereCompiler.compile(WhereCompiler.java:138)
at 
org.apache.phoenix.compile.WhereCompiler.compile(WhereCompiler.java:108)
at 
org.apache.phoenix.compile.QueryCompiler.compileSingleFlatQuery(QueryCompiler.java:559)
at 
org.apache.phoenix.compile.QueryCompiler.compileSingleQuery(QueryCompiler.java:510)
at 
org.apache.phoenix.compile.QueryCompiler.compileSelect(QueryCompiler.java:195)
at 
org.apache.phoenix.compile.QueryCompiler.compile(QueryCompiler.java:155)
at 
org.apache.phoenix.compile.QueryCompiler.compileSubquery(QueryCompiler.java:499)
at 
org.apache.phoenix.compile.QueryCompiler.compileJoinQuery(QueryCompiler.java:221)
at 
org.apache.phoenix.compile.QueryCompiler.compileJoinQuery(QueryCompiler.java:295)
at 
org.apache.phoenix.compile.QueryCompiler.compileJoinQuery(QueryCompiler.java:230)
at 
org.apache.phoenix.compile.QueryCompiler.compileSelect(QueryCompiler.java:193)
at 
org.apache.phoenix.compile.QueryCompiler.compile(QueryCompiler.java:155)
at 
org.apache.phoenix.optimize.QueryOptimizer.addPlan(QueryOptimizer.java:399)
at 
org.apache.phoenix.optimize.QueryOptimizer.getHintedQueryPlan(QueryOptimizer.java:279)
at 
org.apache.phoenix.optimize.QueryOptimizer.getApplicablePlansForSingleFlatQuery(QueryOptimizer.java:220)
at 
org.apache.phoenix.optimize.QueryOptimizer.getApplicablePlans(QueryOptimizer.java:133)
at 
org.apache.phoenix.optimize.QueryOptimizer.optimize(QueryOptimizer.java:111)
at 
org.apache.phoenix.optimize.QueryOptimizer.optimize(QueryOptimizer.java:97)
at 
org.apache.phoenix.jdbc.PhoenixStatement$1.call(PhoenixStatement.java:309)
at 
org.apache.phoenix.jdbc.PhoenixStatement$1.call(PhoenixStatement.java:291)
at org.apache.phoenix.call.CallRunner.run(CallRunner.java:53)
at 
org.apache.phoenix.jdbc.PhoenixStatement.executeQuery(PhoenixStatement.java:290)
at 
org.apache.phoenix.jdbc.PhoenixStatement.executeQuery(PhoenixStatement.java:283)
at 
org.apache.phoenix.jdbc.PhoenixStatement.execute(PhoenixStatement.java:1830)
at sqlline.Commands.execute(Commands.java:822)
at sqlline.Commands.sql(Commands.java:732)
at sqlline.SqlLine.dispatch(SqlLine.java:813)
at sqlline.SqlLine.begin(SqlLine.java:686)
at sqlline.SqlLine.start(SqlLine.java:398)
at sqlline.SqlLine.main(SqlLine.java:291)
{code}

  was:
Example:
{{create table test (pk integer primary key, v1 float, v2 float, v3 integer);}}
{{create local index l1 on test(v1);}}
{{select /*+ INDEX(test l1) */ * from test where v2 = 1;}}

{code}
0: jdbc:phoenix:localhost> select /*+ INDEX(test l1) */ * from test where v2 = 
1;
Error: ERROR 504 (42703): Undefined column. columnName=TEST.V2 
(state=42703,code=504)
org.apache.phoenix.schema.ColumnNotFoundException: ERROR 504 (42703): Undefined 
column. columnName=TEST.V2
at 
org.apache.phoenix.compile.WhereCompiler$WhereExpressionCompiler.resolveColumn(WhereCompiler.java:202)
at 
org.apache.phoenix.compile.WhereCompiler$WhereExpressionCompiler.visit(WhereCompiler.java:177)
at 
org.apache.phoenix.compile.WhereCompiler$WhereExpressionCompiler.visit(WhereCompiler.java:164)
at 

[jira] [Updated] (PHOENIX-5109) Allow local indexes to work for queries with uncovered columns.

2019-01-24 Thread Lars Hofhansl (JIRA)


 [ 
https://issues.apache.org/jira/browse/PHOENIX-5109?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Lars Hofhansl updated PHOENIX-5109:
---
Summary: Allow local indexes to work for queries with uncovered columns.  
(was: Hinted local index with uncovered column in the WHERE clause throws an 
exception.)

> Allow local indexes to work for queries with uncovered columns.
> ---
>
> Key: PHOENIX-5109
> URL: https://issues.apache.org/jira/browse/PHOENIX-5109
> Project: Phoenix
>  Issue Type: Bug
>Affects Versions: 4.14.1
>Reporter: Lars Hofhansl
>Assignee: Lars Hofhansl
>Priority: Major
> Attachments: 5109-v1.txt, 5109-v2.txt, 5109-v3.txt, 5109-v4-master.txt
>
>
> Example:
> {{create table test (pk integer primary key, v1 float, v2 float, v3 
> integer);}}
> {{create local index l1 on test(v1);}}
> {{select /*+ INDEX(test l1) */ * from test where v2 = 1;}}
> {code}
> 0: jdbc:phoenix:localhost> select /*+ INDEX(test l1) */ * from test where v2 
> = 1;
> Error: ERROR 504 (42703): Undefined column. columnName=TEST.V2 
> (state=42703,code=504)
> org.apache.phoenix.schema.ColumnNotFoundException: ERROR 504 (42703): 
> Undefined column. columnName=TEST.V2
>   at 
> org.apache.phoenix.compile.WhereCompiler$WhereExpressionCompiler.resolveColumn(WhereCompiler.java:202)
>   at 
> org.apache.phoenix.compile.WhereCompiler$WhereExpressionCompiler.visit(WhereCompiler.java:177)
>   at 
> org.apache.phoenix.compile.WhereCompiler$WhereExpressionCompiler.visit(WhereCompiler.java:164)
>   at 
> org.apache.phoenix.parse.ColumnParseNode.accept(ColumnParseNode.java:56)
>   at 
> org.apache.phoenix.parse.CompoundParseNode.acceptChildren(CompoundParseNode.java:64)
>   at org.apache.phoenix.parse.CastParseNode.accept(CastParseNode.java:60)
>   at 
> org.apache.phoenix.parse.CompoundParseNode.acceptChildren(CompoundParseNode.java:64)
>   at 
> org.apache.phoenix.parse.ComparisonParseNode.accept(ComparisonParseNode.java:45)
>   at 
> org.apache.phoenix.compile.WhereCompiler.compile(WhereCompiler.java:138)
>   at 
> org.apache.phoenix.compile.WhereCompiler.compile(WhereCompiler.java:108)
>   at 
> org.apache.phoenix.compile.QueryCompiler.compileSingleFlatQuery(QueryCompiler.java:559)
>   at 
> org.apache.phoenix.compile.QueryCompiler.compileSingleQuery(QueryCompiler.java:510)
>   at 
> org.apache.phoenix.compile.QueryCompiler.compileSelect(QueryCompiler.java:195)
>   at 
> org.apache.phoenix.compile.QueryCompiler.compile(QueryCompiler.java:155)
>   at 
> org.apache.phoenix.compile.QueryCompiler.compileSubquery(QueryCompiler.java:499)
>   at 
> org.apache.phoenix.compile.QueryCompiler.compileJoinQuery(QueryCompiler.java:221)
>   at 
> org.apache.phoenix.compile.QueryCompiler.compileJoinQuery(QueryCompiler.java:295)
>   at 
> org.apache.phoenix.compile.QueryCompiler.compileJoinQuery(QueryCompiler.java:230)
>   at 
> org.apache.phoenix.compile.QueryCompiler.compileSelect(QueryCompiler.java:193)
>   at 
> org.apache.phoenix.compile.QueryCompiler.compile(QueryCompiler.java:155)
>   at 
> org.apache.phoenix.optimize.QueryOptimizer.addPlan(QueryOptimizer.java:399)
>   at 
> org.apache.phoenix.optimize.QueryOptimizer.getHintedQueryPlan(QueryOptimizer.java:279)
>   at 
> org.apache.phoenix.optimize.QueryOptimizer.getApplicablePlansForSingleFlatQuery(QueryOptimizer.java:220)
>   at 
> org.apache.phoenix.optimize.QueryOptimizer.getApplicablePlans(QueryOptimizer.java:133)
>   at 
> org.apache.phoenix.optimize.QueryOptimizer.optimize(QueryOptimizer.java:111)
>   at 
> org.apache.phoenix.optimize.QueryOptimizer.optimize(QueryOptimizer.java:97)
>   at 
> org.apache.phoenix.jdbc.PhoenixStatement$1.call(PhoenixStatement.java:309)
>   at 
> org.apache.phoenix.jdbc.PhoenixStatement$1.call(PhoenixStatement.java:291)
>   at org.apache.phoenix.call.CallRunner.run(CallRunner.java:53)
>   at 
> org.apache.phoenix.jdbc.PhoenixStatement.executeQuery(PhoenixStatement.java:290)
>   at 
> org.apache.phoenix.jdbc.PhoenixStatement.executeQuery(PhoenixStatement.java:283)
>   at 
> org.apache.phoenix.jdbc.PhoenixStatement.execute(PhoenixStatement.java:1830)
>   at sqlline.Commands.execute(Commands.java:822)
>   at sqlline.Commands.sql(Commands.java:732)
>   at sqlline.SqlLine.dispatch(SqlLine.java:813)
>   at sqlline.SqlLine.begin(SqlLine.java:686)
>   at sqlline.SqlLine.start(SqlLine.java:398)
>   at sqlline.SqlLine.main(SqlLine.java:291)
> {code}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)