You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@phoenix.apache.org by "Bulvik, Noam" <No...@teoco.com> on 2017/10/01 09:01:11 UTC

error when using hint on global index where table is using row timestamp mapping

Hi

I have create a table and used the row timestamp mapping functionality. The key of the table is <timestamp_column>+<row_id> column. I also created global index on one of the columns of the table  (XXX not one of the key columns).

When I am doing  explain select * from my_table where xxx='<value>' I see that index is not used  (even though index is defined on XX column )

CLIENT 9-CHUNK PARALLEL 9-WAY ROUND ROBIN FULL SCAN OVER MY_TABLE
    ROW TIMESTAMP FILTER [0, 1506847791496)
    SERVER FILTER BY XXX = '<some value>'

When I am adding hint I get the following exception (this is from explain ..., I get similar error when running the actual query )

java.lang.NullPointerException
               at org.apache.phoenix.compile.ScanRanges.getAscTimeRange(ScanRanges.java:674)
               at org.apache.phoenix.compile.ScanRanges.getRowTimestampColumnRange(ScanRanges.java:658)
               at org.apache.phoenix.compile.ScanRanges.create(ScanRanges.java:84)
               at org.apache.phoenix.compile.WhereOptimizer.pushKeyExpressionsToScan(WhereOptimizer.java:305)
               at org.apache.phoenix.compile.WhereOptimizer.pushKeyExpressionsToScan(WhereOptimizer.java:104)
               at org.apache.phoenix.compile.WhereOptimizer.getKeyExpressionCombination(WhereOptimizer.java:385)
               at org.apache.phoenix.compile.QueryCompiler.getKeyExpressionCombinations(QueryCompiler.java:460)
               at org.apache.phoenix.compile.QueryCompiler.compileJoinQuery(QueryCompiler.java:314)
               at org.apache.phoenix.compile.QueryCompiler.compileSelect(QueryCompiler.java:200)
               at org.apache.phoenix.compile.QueryCompiler.compile(QueryCompiler.java:157)
               at org.apache.phoenix.optimize.QueryOptimizer.addPlan(QueryOptimizer.java:302)
               at org.apache.phoenix.optimize.QueryOptimizer.getHintedQueryPlan(QueryOptimizer.java:196)
               at org.apache.phoenix.optimize.QueryOptimizer.getApplicablePlans(QueryOptimizer.java:137)
               at org.apache.phoenix.optimize.QueryOptimizer.optimize(QueryOptimizer.java:94)
               at org.apache.phoenix.optimize.QueryOptimizer.optimize(QueryOptimizer.java:80)
               at org.apache.phoenix.execute.BaseQueryPlan.getExplainPlan(BaseQueryPlan.java:505)
               at org.apache.phoenix.jdbc.PhoenixStatement$ExecutableExplainStatement.compilePlan(PhoenixStatement.java:568)
               at org.apache.phoenix.jdbc.PhoenixStatement$ExecutableExplainStatement.compilePlan(PhoenixStatement.java:547)
               at org.apache.phoenix.jdbc.PhoenixStatement$1.call(PhoenixStatement.java:299)
               at org.apache.phoenix.jdbc.PhoenixStatement$1.call(PhoenixStatement.java:289)
               at org.apache.phoenix.call.CallRunner.run(CallRunner.java:53)
               at org.apache.phoenix.jdbc.PhoenixStatement.executeQuery(PhoenixStatement.java:288)
               at org.apache.phoenix.jdbc.PhoenixStatement.executeQuery(PhoenixStatement.java:282)
               at org.apache.phoenix.jdbc.PhoenixStatement.execute(PhoenixStatement.java:1711)
               at workbench.sql.SqlCommand.execute(SqlCommand.java:555)
               at workbench.sql.StatementRunner.runStatement(StatementRunner.java:584)
               at workbench.gui.sql.SqlPanel.displayResult(SqlPanel.java:3433)
               at workbench.gui.sql.SqlPanel.runStatement(SqlPanel.java:2169)
               at workbench.gui.sql.SqlPanel$4.run(SqlPanel.java:2107)



I am using phoenix 4.11


Noam


________________________________

PRIVILEGED AND CONFIDENTIAL
PLEASE NOTE: The information contained in this message is privileged and confidential, and is intended only for the use of the individual to whom it is addressed and others who have been specifically authorized to receive it. If you are not the intended recipient, you are hereby notified that any dissemination, distribution or copying of this communication is strictly prohibited. If you have received this communication in error, or if any problems occur with transmission, please contact sender. Thank you.

RE: error when using hint on global index where table is using row timestamp mapping

Posted by "Bulvik, Noam" <No...@teoco.com>.
Thanks
Any idea when 4.12 will be available ?

From: James Taylor [mailto:jamestaylor@apache.org]
Sent: Monday, October 2, 2017 7:16 PM
To: user <us...@phoenix.apache.org>
Cc: Sapir, Yoav <Yo...@teoco.com>
Subject: Re: error when using hint on global index where table is using row timestamp mapping

I filed PHOENIX-4265, but I'm not able to repro the issue. Let's continue the discussion there. Please read the description for limitations on indexes with row_timestamp column too for 4.12.

Thanks,
James

On Mon, Oct 2, 2017 at 12:38 AM, Bulvik, Noam <No...@teoco.com>> wrote:
It is simple TABLE with ~100 fields all are either timestamp, varchar or double

CREATE TABLE MY_TABLE
(
Row_time                         TIMESTAMP   not null,
 Row_id                    VARCHAR     NOT NULL,
   A                      VARCHAR     ,
   B                      VARCHAR     ,
   B                     VARCHAR     ,
   D                      VARCHAR     ,
   …some more field
..

CONSTRAINT PK PRIMARY KEY (Row_time ROW_TIMESTAMP, Row_id)
)  SALT_BUCKETS = 9

And some indexes like the ones below

CREATE INDEX A_GLOBAL_IDX ON MY_TABLE ("A");
CREATE INDEX B_GLOBAL_IDX ON MY_TABLE ("B");
CREATE INDEX C_GLOBAL_IDX ON MY_TABLE ("C");
…

The query is simply select * from MY_TABLE where A="<some value >"


Thanks for helping us out

From: Samarth Jain [mailto:samarth@apache.org<ma...@apache.org>]
Sent: Monday, October 2, 2017 9:43 AM
To: user@phoenix.apache.org<ma...@phoenix.apache.org>
Cc: Sapir, Yoav <Yo...@teoco.com>>
Subject: Re: error when using hint on global index where table is using row timestamp mapping

Hi Noam,

Can you pass on the DDL statements for the table and index and the query you are executing, please?

Thanks!

On Sun, Oct 1, 2017 at 2:01 AM, Bulvik, Noam <No...@teoco.com>> wrote:
Hi

I have create a table and used the row timestamp mapping functionality. The key of the table is <timestamp_column>+<row_id> column. I also created global index on one of the columns of the table  (XXX not one of the key columns).

When I am doing  explain select * from my_table where xxx='<value>' I see that index is not used  (even though index is defined on XX column )

CLIENT 9-CHUNK PARALLEL 9-WAY ROUND ROBIN FULL SCAN OVER MY_TABLE
    ROW TIMESTAMP FILTER [0, 1506847791496)
    SERVER FILTER BY XXX = '<some value>'

When I am adding hint I get the following exception (this is from explain …, I get similar error when running the actual query )

java.lang.NullPointerException
               at org.apache.phoenix.compile.ScanRanges.getAscTimeRange(ScanRanges.java:674)
               at org.apache.phoenix.compile.ScanRanges.getRowTimestampColumnRange(ScanRanges.java:658)
               at org.apache.phoenix.compile.ScanRanges.create(ScanRanges.java:84)
               at org.apache.phoenix.compile.WhereOptimizer.pushKeyExpressionsToScan(WhereOptimizer.java:305)
               at org.apache.phoenix.compile.WhereOptimizer.pushKeyExpressionsToScan(WhereOptimizer.java:104)
               at org.apache.phoenix.compile.WhereOptimizer.getKeyExpressionCombination(WhereOptimizer.java:385)
               at org.apache.phoenix.compile.QueryCompiler.getKeyExpressionCombinations(QueryCompiler.java:460)
               at org.apache.phoenix.compile.QueryCompiler.compileJoinQuery(QueryCompiler.java:314)
               at org.apache.phoenix.compile.QueryCompiler.compileSelect(QueryCompiler.java:200)
               at org.apache.phoenix.compile.QueryCompiler.compile(QueryCompiler.java:157)
               at org.apache.phoenix.optimize.QueryOptimizer.addPlan(QueryOptimizer.java:302)
               at org.apache.phoenix.optimize.QueryOptimizer.getHintedQueryPlan(QueryOptimizer.java:196)
               at org.apache.phoenix.optimize.QueryOptimizer.getApplicablePlans(QueryOptimizer.java:137)
               at org.apache.phoenix.optimize.QueryOptimizer.optimize(QueryOptimizer.java:94)
               at org.apache.phoenix.optimize.QueryOptimizer.optimize(QueryOptimizer.java:80)
               at org.apache.phoenix.execute.BaseQueryPlan.getExplainPlan(BaseQueryPlan.java:505)
               at org.apache.phoenix.jdbc.PhoenixStatement$ExecutableExplainStatement.compilePlan(PhoenixStatement.java:568)
               at org.apache.phoenix.jdbc.PhoenixStatement$ExecutableExplainStatement.compilePlan(PhoenixStatement.java:547)
               at org.apache.phoenix.jdbc.PhoenixStatement$1.call(PhoenixStatement.java:299)
               at org.apache.phoenix.jdbc.PhoenixStatement$1.call(PhoenixStatement.java:289)
               at org.apache.phoenix.call.CallRunner.run(CallRunner.java:53)
               at org.apache.phoenix.jdbc.PhoenixStatement.executeQuery(PhoenixStatement.java:288)
               at org.apache.phoenix.jdbc.PhoenixStatement.executeQuery(PhoenixStatement.java:282)
               at org.apache.phoenix.jdbc.PhoenixStatement.execute(PhoenixStatement.java:1711)
               at workbench.sql.SqlCommand.execute(SqlCommand.java:555)
               at workbench.sql.StatementRunner.runStatement(StatementRunner.java:584)
               at workbench.gui.sql.SqlPanel.displayResult(SqlPanel.java:3433)
               at workbench.gui.sql.SqlPanel.runStatement(SqlPanel.java:2169)
               at workbench.gui.sql.SqlPanel$4.run(SqlPanel.java:2107)



I am using phoenix 4.11


Noam


________________________________

PRIVILEGED AND CONFIDENTIAL
PLEASE NOTE: The information contained in this message is privileged and confidential, and is intended only for the use of the individual to whom it is addressed and others who have been specifically authorized to receive it. If you are not the intended recipient, you are hereby notified that any dissemination, distribution or copying of this communication is strictly prohibited. If you have received this communication in error, or if any problems occur with transmission, please contact sender. Thank you.


________________________________

PRIVILEGED AND CONFIDENTIAL
PLEASE NOTE: The information contained in this message is privileged and confidential, and is intended only for the use of the individual to whom it is addressed and others who have been specifically authorized to receive it. If you are not the intended recipient, you are hereby notified that any dissemination, distribution or copying of this communication is strictly prohibited. If you have received this communication in error, or if any problems occur with transmission, please contact sender. Thank you.


________________________________

PRIVILEGED AND CONFIDENTIAL
PLEASE NOTE: The information contained in this message is privileged and confidential, and is intended only for the use of the individual to whom it is addressed and others who have been specifically authorized to receive it. If you are not the intended recipient, you are hereby notified that any dissemination, distribution or copying of this communication is strictly prohibited. If you have received this communication in error, or if any problems occur with transmission, please contact sender. Thank you.

Re: error when using hint on global index where table is using row timestamp mapping

Posted by James Taylor <ja...@apache.org>.
I filed PHOENIX-4265, but I'm not able to repro the issue. Let's continue
the discussion there. Please read the description for limitations on
indexes with row_timestamp column too for 4.12.

Thanks,
James

On Mon, Oct 2, 2017 at 12:38 AM, Bulvik, Noam <No...@teoco.com> wrote:

> It is simple TABLE with ~100 fields all are either timestamp, varchar or
> double
>
>
>
> CREATE TABLE MY_TABLE
>
> (
>
> Row_time                         TIMESTAMP   not null,
>
>  Row_id                    VARCHAR     NOT NULL,
>
>    A                      VARCHAR     ,
>
>    B                      VARCHAR     ,
>
>    B                     VARCHAR     ,
>
>    D                      VARCHAR     ,
>
>    …some more field
>
> ..
>
>
>
> CONSTRAINT PK PRIMARY KEY (Row_time ROW_TIMESTAMP, Row_id)
>
> )  SALT_BUCKETS = 9
>
>
>
> And some indexes like the ones below
>
>
>
> CREATE INDEX A_GLOBAL_IDX ON MY_TABLE ("A");
>
> CREATE INDEX B_GLOBAL_IDX ON MY_TABLE ("B");
>
> CREATE INDEX C_GLOBAL_IDX ON MY_TABLE ("C");
>
> …
>
>
>
> The query is simply select * from MY_TABLE where A="<some value >"
>
>
>
>
>
> Thanks for helping us out
>
>
>
> *From:* Samarth Jain [mailto:samarth@apache.org]
> *Sent:* Monday, October 2, 2017 9:43 AM
> *To:* user@phoenix.apache.org
> *Cc:* Sapir, Yoav <Yo...@teoco.com>
> *Subject:* Re: error when using hint on global index where table is using
> row timestamp mapping
>
>
>
> Hi Noam,
>
>
>
> Can you pass on the DDL statements for the table and index and the query
> you are executing, please?
>
>
>
> Thanks!
>
>
>
> On Sun, Oct 1, 2017 at 2:01 AM, Bulvik, Noam <No...@teoco.com>
> wrote:
>
> Hi
>
>
>
> I have create a table and used the row timestamp mapping functionality.
> The key of the table is <timestamp_column>+<row_id> column. I also created
> global index on one of the columns of the table  (XXX not one of the key
> columns).
>
>
>
> When I am doing  explain select * from my_table where xxx='<value>' I see
> that index is not used  (even though index is defined on XX column )
>
>
>
> CLIENT 9-CHUNK PARALLEL 9-WAY ROUND ROBIN FULL SCAN OVER
> MY_TABLE
>
>     ROW TIMESTAMP FILTER [0, 1506847791496)
>
>     SERVER FILTER BY XXX = '<some value>'
>
>
>
> When I am adding hint I get the following exception (this is from explain
> …, I get similar error when running the actual query )
>
>
>
> java.lang.NullPointerException
>
>                at org.apache.phoenix.compile.ScanRanges.getAscTimeRange(
> ScanRanges.java:674)
>
>                at org.apache.phoenix.compile.ScanRanges.
> getRowTimestampColumnRange(ScanRanges.java:658)
>
>                at org.apache.phoenix.compile.ScanRanges.create(ScanRanges.
> java:84)
>
>                at org.apache.phoenix.compile.WhereOptimizer.
> pushKeyExpressionsToScan(WhereOptimizer.java:305)
>
>                at org.apache.phoenix.compile.WhereOptimizer.
> pushKeyExpressionsToScan(WhereOptimizer.java:104)
>
>                at org.apache.phoenix.compile.WhereOptimizer.
> getKeyExpressionCombination(WhereOptimizer.java:385)
>
>                at org.apache.phoenix.compile.QueryCompiler.
> getKeyExpressionCombinations(QueryCompiler.java:460)
>
>                at org.apache.phoenix.compile.QueryCompiler.
> compileJoinQuery(QueryCompiler.java:314)
>
>                at org.apache.phoenix.compile.QueryCompiler.compileSelect(
> QueryCompiler.java:200)
>
>                at org.apache.phoenix.compile.QueryCompiler.compile(
> QueryCompiler.java:157)
>
>                at org.apache.phoenix.optimize.QueryOptimizer.addPlan(
> QueryOptimizer.java:302)
>
>                at org.apache.phoenix.optimize.QueryOptimizer.
> getHintedQueryPlan(QueryOptimizer.java:196)
>
>                at org.apache.phoenix.optimize.QueryOptimizer.
> getApplicablePlans(QueryOptimizer.java:137)
>
>                at org.apache.phoenix.optimize.QueryOptimizer.optimize(
> QueryOptimizer.java:94)
>
>                at org.apache.phoenix.optimize.QueryOptimizer.optimize(
> QueryOptimizer.java:80)
>
>                at org.apache.phoenix.execute.BaseQueryPlan.getExplainPlan(
> BaseQueryPlan.java:505)
>
>                at org.apache.phoenix.jdbc.PhoenixStatement$
> ExecutableExplainStatement.compilePlan(PhoenixStatement.java:568)
>
>                at org.apache.phoenix.jdbc.PhoenixStatement$
> ExecutableExplainStatement.compilePlan(PhoenixStatement.java:547)
>
>                at org.apache.phoenix.jdbc.PhoenixStatement$1.call(
> PhoenixStatement.java:299)
>
>                at org.apache.phoenix.jdbc.PhoenixStatement$1.call(
> PhoenixStatement.java:289)
>
>                at org.apache.phoenix.call.CallRunner.run(CallRunner.
> java:53)
>
>                at org.apache.phoenix.jdbc.PhoenixStatement.executeQuery(
> PhoenixStatement.java:288)
>
>                at org.apache.phoenix.jdbc.PhoenixStatement.executeQuery(
> PhoenixStatement.java:282)
>
>                at org.apache.phoenix.jdbc.PhoenixStatement.execute(
> PhoenixStatement.java:1711)
>
>                at workbench.sql.SqlCommand.execute(SqlCommand.java:555)
>
>                at workbench.sql.StatementRunner.
> runStatement(StatementRunner.java:584)
>
>                at workbench.gui.sql.SqlPanel.displayResult(SqlPanel.java:
> 3433)
>
>                at workbench.gui.sql.SqlPanel.runStatement(SqlPanel.java:
> 2169)
>
>                at workbench.gui.sql.SqlPanel$4.run(SqlPanel.java:2107)
>
>
>
>
>
>
>
> I am using phoenix 4.11
>
>
>
>
>
> *Noam *
>
>
>
>
> ------------------------------
>
>
> PRIVILEGED AND CONFIDENTIAL
> PLEASE NOTE: The information contained in this message is privileged and
> confidential, and is intended only for the use of the individual to whom it
> is addressed and others who have been specifically authorized to receive
> it. If you are not the intended recipient, you are hereby notified that any
> dissemination, distribution or copying of this communication is strictly
> prohibited. If you have received this communication in error, or if any
> problems occur with transmission, please contact sender. Thank you.
>
>
>
> ------------------------------
>
> PRIVILEGED AND CONFIDENTIAL
> PLEASE NOTE: The information contained in this message is privileged and
> confidential, and is intended only for the use of the individual to whom it
> is addressed and others who have been specifically authorized to receive
> it. If you are not the intended recipient, you are hereby notified that any
> dissemination, distribution or copying of this communication is strictly
> prohibited. If you have received this communication in error, or if any
> problems occur with transmission, please contact sender. Thank you.
>

RE: error when using hint on global index where table is using row timestamp mapping

Posted by "Bulvik, Noam" <No...@teoco.com>.
It is simple TABLE with ~100 fields all are either timestamp, varchar or double

CREATE TABLE MY_TABLE
(
Row_time                         TIMESTAMP   not null,
 Row_id                    VARCHAR     NOT NULL,
   A                      VARCHAR     ,
   B                      VARCHAR     ,
   B                     VARCHAR     ,
   D                      VARCHAR     ,
   …some more field
..

CONSTRAINT PK PRIMARY KEY (Row_time ROW_TIMESTAMP, Row_id)
)  SALT_BUCKETS = 9

And some indexes like the ones below

CREATE INDEX A_GLOBAL_IDX ON MY_TABLE ("A");
CREATE INDEX B_GLOBAL_IDX ON MY_TABLE ("B");
CREATE INDEX C_GLOBAL_IDX ON MY_TABLE ("C");
…

The query is simply select * from MY_TABLE where A="<some value >"


Thanks for helping us out

From: Samarth Jain [mailto:samarth@apache.org]
Sent: Monday, October 2, 2017 9:43 AM
To: user@phoenix.apache.org
Cc: Sapir, Yoav <Yo...@teoco.com>
Subject: Re: error when using hint on global index where table is using row timestamp mapping

Hi Noam,

Can you pass on the DDL statements for the table and index and the query you are executing, please?

Thanks!

On Sun, Oct 1, 2017 at 2:01 AM, Bulvik, Noam <No...@teoco.com>> wrote:
Hi

I have create a table and used the row timestamp mapping functionality. The key of the table is <timestamp_column>+<row_id> column. I also created global index on one of the columns of the table  (XXX not one of the key columns).

When I am doing  explain select * from my_table where xxx='<value>' I see that index is not used  (even though index is defined on XX column )

CLIENT 9-CHUNK PARALLEL 9-WAY ROUND ROBIN FULL SCAN OVER MY_TABLE
    ROW TIMESTAMP FILTER [0, 1506847791496)
    SERVER FILTER BY XXX = '<some value>'

When I am adding hint I get the following exception (this is from explain …, I get similar error when running the actual query )

java.lang.NullPointerException
               at org.apache.phoenix.compile.ScanRanges.getAscTimeRange(ScanRanges.java:674)
               at org.apache.phoenix.compile.ScanRanges.getRowTimestampColumnRange(ScanRanges.java:658)
               at org.apache.phoenix.compile.ScanRanges.create(ScanRanges.java:84)
               at org.apache.phoenix.compile.WhereOptimizer.pushKeyExpressionsToScan(WhereOptimizer.java:305)
               at org.apache.phoenix.compile.WhereOptimizer.pushKeyExpressionsToScan(WhereOptimizer.java:104)
               at org.apache.phoenix.compile.WhereOptimizer.getKeyExpressionCombination(WhereOptimizer.java:385)
               at org.apache.phoenix.compile.QueryCompiler.getKeyExpressionCombinations(QueryCompiler.java:460)
               at org.apache.phoenix.compile.QueryCompiler.compileJoinQuery(QueryCompiler.java:314)
               at org.apache.phoenix.compile.QueryCompiler.compileSelect(QueryCompiler.java:200)
               at org.apache.phoenix.compile.QueryCompiler.compile(QueryCompiler.java:157)
               at org.apache.phoenix.optimize.QueryOptimizer.addPlan(QueryOptimizer.java:302)
               at org.apache.phoenix.optimize.QueryOptimizer.getHintedQueryPlan(QueryOptimizer.java:196)
               at org.apache.phoenix.optimize.QueryOptimizer.getApplicablePlans(QueryOptimizer.java:137)
               at org.apache.phoenix.optimize.QueryOptimizer.optimize(QueryOptimizer.java:94)
               at org.apache.phoenix.optimize.QueryOptimizer.optimize(QueryOptimizer.java:80)
               at org.apache.phoenix.execute.BaseQueryPlan.getExplainPlan(BaseQueryPlan.java:505)
               at org.apache.phoenix.jdbc.PhoenixStatement$ExecutableExplainStatement.compilePlan(PhoenixStatement.java:568)
               at org.apache.phoenix.jdbc.PhoenixStatement$ExecutableExplainStatement.compilePlan(PhoenixStatement.java:547)
               at org.apache.phoenix.jdbc.PhoenixStatement$1.call(PhoenixStatement.java:299)
               at org.apache.phoenix.jdbc.PhoenixStatement$1.call(PhoenixStatement.java:289)
               at org.apache.phoenix.call.CallRunner.run(CallRunner.java:53)
               at org.apache.phoenix.jdbc.PhoenixStatement.executeQuery(PhoenixStatement.java:288)
               at org.apache.phoenix.jdbc.PhoenixStatement.executeQuery(PhoenixStatement.java:282)
               at org.apache.phoenix.jdbc.PhoenixStatement.execute(PhoenixStatement.java:1711)
               at workbench.sql.SqlCommand.execute(SqlCommand.java:555)
               at workbench.sql.StatementRunner.runStatement(StatementRunner.java:584)
               at workbench.gui.sql.SqlPanel.displayResult(SqlPanel.java:3433)
               at workbench.gui.sql.SqlPanel.runStatement(SqlPanel.java:2169)
               at workbench.gui.sql.SqlPanel$4.run(SqlPanel.java:2107)



I am using phoenix 4.11


Noam


________________________________

PRIVILEGED AND CONFIDENTIAL
PLEASE NOTE: The information contained in this message is privileged and confidential, and is intended only for the use of the individual to whom it is addressed and others who have been specifically authorized to receive it. If you are not the intended recipient, you are hereby notified that any dissemination, distribution or copying of this communication is strictly prohibited. If you have received this communication in error, or if any problems occur with transmission, please contact sender. Thank you.


________________________________

PRIVILEGED AND CONFIDENTIAL
PLEASE NOTE: The information contained in this message is privileged and confidential, and is intended only for the use of the individual to whom it is addressed and others who have been specifically authorized to receive it. If you are not the intended recipient, you are hereby notified that any dissemination, distribution or copying of this communication is strictly prohibited. If you have received this communication in error, or if any problems occur with transmission, please contact sender. Thank you.

Re: error when using hint on global index where table is using row timestamp mapping

Posted by Samarth Jain <sa...@apache.org>.
Hi Noam,

Can you pass on the DDL statements for the table and index and the query
you are executing, please?

Thanks!

On Sun, Oct 1, 2017 at 2:01 AM, Bulvik, Noam <No...@teoco.com> wrote:

> Hi
>
>
>
> I have create a table and used the row timestamp mapping functionality.
> The key of the table is <timestamp_column>+<row_id> column. I also created
> global index on one of the columns of the table  (XXX not one of the key
> columns).
>
>
>
> When I am doing  explain select * from my_table where xxx='<value>' I see
> that index is not used  (even though index is defined on XX column )
>
>
>
> CLIENT 9-CHUNK PARALLEL 9-WAY ROUND ROBIN FULL SCAN OVER
> MY_TABLE
>
>     ROW TIMESTAMP FILTER [0, 1506847791496)
>
>     SERVER FILTER BY XXX = '<some value>'
>
>
>
> When I am adding hint I get the following exception (this is from explain
> …, I get similar error when running the actual query )
>
>
>
> java.lang.NullPointerException
>
>                at org.apache.phoenix.compile.ScanRanges.getAscTimeRange(
> ScanRanges.java:674)
>
>                at org.apache.phoenix.compile.ScanRanges.
> getRowTimestampColumnRange(ScanRanges.java:658)
>
>                at org.apache.phoenix.compile.ScanRanges.create(ScanRanges.
> java:84)
>
>                at org.apache.phoenix.compile.WhereOptimizer.
> pushKeyExpressionsToScan(WhereOptimizer.java:305)
>
>                at org.apache.phoenix.compile.WhereOptimizer.
> pushKeyExpressionsToScan(WhereOptimizer.java:104)
>
>                at org.apache.phoenix.compile.WhereOptimizer.
> getKeyExpressionCombination(WhereOptimizer.java:385)
>
>                at org.apache.phoenix.compile.QueryCompiler.
> getKeyExpressionCombinations(QueryCompiler.java:460)
>
>                at org.apache.phoenix.compile.QueryCompiler.
> compileJoinQuery(QueryCompiler.java:314)
>
>                at org.apache.phoenix.compile.QueryCompiler.compileSelect(
> QueryCompiler.java:200)
>
>                at org.apache.phoenix.compile.QueryCompiler.compile(
> QueryCompiler.java:157)
>
>                at org.apache.phoenix.optimize.QueryOptimizer.addPlan(
> QueryOptimizer.java:302)
>
>                at org.apache.phoenix.optimize.QueryOptimizer.
> getHintedQueryPlan(QueryOptimizer.java:196)
>
>                at org.apache.phoenix.optimize.QueryOptimizer.
> getApplicablePlans(QueryOptimizer.java:137)
>
>                at org.apache.phoenix.optimize.QueryOptimizer.optimize(
> QueryOptimizer.java:94)
>
>                at org.apache.phoenix.optimize.QueryOptimizer.optimize(
> QueryOptimizer.java:80)
>
>                at org.apache.phoenix.execute.BaseQueryPlan.getExplainPlan(
> BaseQueryPlan.java:505)
>
>                at org.apache.phoenix.jdbc.PhoenixStatement$
> ExecutableExplainStatement.compilePlan(PhoenixStatement.java:568)
>
>                at org.apache.phoenix.jdbc.PhoenixStatement$
> ExecutableExplainStatement.compilePlan(PhoenixStatement.java:547)
>
>                at org.apache.phoenix.jdbc.PhoenixStatement$1.call(
> PhoenixStatement.java:299)
>
>                at org.apache.phoenix.jdbc.PhoenixStatement$1.call(
> PhoenixStatement.java:289)
>
>                at org.apache.phoenix.call.CallRunner.run(CallRunner.
> java:53)
>
>                at org.apache.phoenix.jdbc.PhoenixStatement.executeQuery(
> PhoenixStatement.java:288)
>
>                at org.apache.phoenix.jdbc.PhoenixStatement.executeQuery(
> PhoenixStatement.java:282)
>
>                at org.apache.phoenix.jdbc.PhoenixStatement.execute(
> PhoenixStatement.java:1711)
>
>                at workbench.sql.SqlCommand.execute(SqlCommand.java:555)
>
>                at workbench.sql.StatementRunner.
> runStatement(StatementRunner.java:584)
>
>                at workbench.gui.sql.SqlPanel.displayResult(SqlPanel.java:
> 3433)
>
>                at workbench.gui.sql.SqlPanel.runStatement(SqlPanel.java:
> 2169)
>
>                at workbench.gui.sql.SqlPanel$4.run(SqlPanel.java:2107)
>
>
>
>
>
>
>
> I am using phoenix 4.11
>
>
>
>
>
> *Noam *
>
>
>
> ------------------------------
>
> PRIVILEGED AND CONFIDENTIAL
> PLEASE NOTE: The information contained in this message is privileged and
> confidential, and is intended only for the use of the individual to whom it
> is addressed and others who have been specifically authorized to receive
> it. If you are not the intended recipient, you are hereby notified that any
> dissemination, distribution or copying of this communication is strictly
> prohibited. If you have received this communication in error, or if any
> problems occur with transmission, please contact sender. Thank you.
>