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 <noam.bul...@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:sama...@apache.org] > *Sent:* Monday, October 2, 2017 9:43 AM > *To:* user@phoenix.apache.org > *Cc:* Sapir, Yoav <yoav.sa...@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 <noam.bul...@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. >