You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@phoenix.apache.org by Michael Young <yo...@gmail.com> on 2017/06/13 20:47:04 UTC

Getting negative timestamp on table joins

I'm getting the following error when joining a table with its cloned copy.


select oldtable.dt from OLD_QTABLE as oldtable INNER JOIN NEW_QTABLE as
newtable ON oldtable.dt=newtable.dt  group by oldtable.dt;

java.lang.IllegalArgumentException: Timestamp cannot be negative.
minStamp:-4239669727594509121, maxStamp:3190689910792567145
        at org.apache.hadoop.hbase.io.TimeRange.<init>(TimeRange.java:76)
        at
org.apache.phoenix.compile.ScanRanges.getAscTimeRange(ScanRanges.java:658)
        at
org.apache.phoenix.compile.ScanRanges.getRowTimestampColumnRange(ScanRanges.java:629)
        at org.apache.phoenix.compile.ScanRanges.create(ScanRanges.java:79)
        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:379)
        at
org.apache.phoenix.compile.QueryCompiler.getKeyExpressionCombinations(QueryCompiler.java:463)
        at
org.apache.phoenix.compile.QueryCompiler.compileJoinQuery(QueryCompiler.java:317)
        at
org.apache.phoenix.compile.JoinCompiler.optimize(JoinCompiler.java:1163)
        at
org.apache.phoenix.compile.QueryCompiler.compileSelect(QueryCompiler.java:197)
        at
org.apache.phoenix.compile.QueryCompiler.compile(QueryCompiler.java:160)



NEW_QTABLE is a copy of QTABLE.  I created a snapshot of QTABLE and cloned
snapshot using:

disable 'QTABLE'
snapshot 'QTABLE', 'NEW_QTABLE'
clone_snapshot 'QTABLE_SNAPSHOT', 'NEW_QTABLE'
delete_snapshot 'QTABLE_SNAPSHOT'
enable 'QTABLE'

I then recreate the NEW_QTABLE in Phoenix using the same ddl with the new
table name.

/usr/hdp/current/phoenix-client/bin/sqlline.py zkhost:2181:/hbase-unsecure

0: jdbc:phoenix:zkhost:2181:/hbase-unsecur> CREATE TABLE IF NOT EXISTS
NEW_QTABLE (... etc...);

Note: I did not use the CurrentSCN parameter on connection.

Any ideas how to fix this?

Cheers,
Michael

Re: Getting negative timestamp on table joins

Posted by Michael Young <yo...@gmail.com>.
My issue seems somewhat similar to the following:

https://community.hortonworks.com/questions/89441/phoenix-table-join-query-on-timestamp-column-gener.html

On Tue, Jun 13, 2017 at 1:47 PM, Michael Young <yo...@gmail.com> wrote:

> I'm getting the following error when joining a table with its cloned copy.
>
>
> select oldtable.dt from OLD_QTABLE as oldtable INNER JOIN NEW_QTABLE as
> newtable ON oldtable.dt=newtable.dt  group by oldtable.dt;
>
> java.lang.IllegalArgumentException: Timestamp cannot be negative.
> minStamp:-4239669727594509121, maxStamp:3190689910792567145
>         at org.apache.hadoop.hbase.io.TimeRange.<init>(TimeRange.java:76)
>         at org.apache.phoenix.compile.ScanRanges.getAscTimeRange(
> ScanRanges.java:658)
>         at org.apache.phoenix.compile.ScanRanges.
> getRowTimestampColumnRange(ScanRanges.java:629)
>         at org.apache.phoenix.compile.ScanRanges.create(ScanRanges.
> java:79)
>         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:379)
>         at org.apache.phoenix.compile.QueryCompiler.
> getKeyExpressionCombinations(QueryCompiler.java:463)
>         at org.apache.phoenix.compile.QueryCompiler.compileJoinQuery(
> QueryCompiler.java:317)
>         at org.apache.phoenix.compile.JoinCompiler.optimize(
> JoinCompiler.java:1163)
>         at org.apache.phoenix.compile.QueryCompiler.compileSelect(
> QueryCompiler.java:197)
>         at org.apache.phoenix.compile.QueryCompiler.compile(
> QueryCompiler.java:160)
>
>
>
> NEW_QTABLE is a copy of QTABLE.  I created a snapshot of QTABLE and cloned
> snapshot using:
>
> disable 'QTABLE'
> snapshot 'QTABLE', 'NEW_QTABLE'
> clone_snapshot 'QTABLE_SNAPSHOT', 'NEW_QTABLE'
> delete_snapshot 'QTABLE_SNAPSHOT'
> enable 'QTABLE'
>
> I then recreate the NEW_QTABLE in Phoenix using the same ddl with the new
> table name.
>
> /usr/hdp/current/phoenix-client/bin/sqlline.py zkhost:2181:/hbase-unsecure
>
> 0: jdbc:phoenix:zkhost:2181:/hbase-unsecur> CREATE TABLE IF NOT EXISTS
> NEW_QTABLE (... etc...);
>
> Note: I did not use the CurrentSCN parameter on connection.
>
> Any ideas how to fix this?
>
> Cheers,
> Michael
>