Re: order by primary key desc return wrong results

2018-07-31 Thread James Taylor
Please file a JIRA.

On Mon, Jul 30, 2018 at 10:12 PM, jie chen  wrote:

> phoenix-4.14-hbase-1.2
>
> 0: jdbc:phoenix:localhost>  create table test(id bigint not null primary
>>> key, a bigint);
>>
>> No rows affected (1.242 seconds)
>>
>> 0: jdbc:phoenix:localhost> upsert into test values(1,11);
>>
>> 1 row affected (0.01 seconds)
>>
>> 0: jdbc:phoenix:localhost> upsert into test values(2,22);
>>
>> 1 row affected (0.007 seconds)
>>
>> 0: jdbc:phoenix:localhost> upsert into test values(3,33);
>>
>> 1 row affected (0.005 seconds)
>>
>> 0: jdbc:phoenix:localhost> select * from test;
>>
>> +-+-+
>>
>> | ID  |  A  |
>>
>> +-+-+
>>
>> | 1   | 11  |
>>
>> | 2   | 22  |
>>
>> | 3   | 33  |
>>
>> +-+-+
>>
>> 3 rows selected (0.015 seconds)
>>
>> 0: jdbc:phoenix:localhost> select * from test order by id desc limit 2
>>> offset 0;
>>
>> +-+-+
>>
>> | ID  |  A  |
>>
>> +-+-+
>>
>> | 3   | 33  |
>>
>> | 2   | 22  |
>>
>> +-+-+
>>
>> 2 rows selected (0.018 seconds)
>>
>> 0: jdbc:phoenix:localhost> select * from test where id in (select id from
>>> test ) order by id desc limit 2 offset 0;
>>
>> +-+-+
>>
>> | ID  |  A  |
>>
>> +-+-+
>>
>> | 2   | 22  |
>>
>> | 1   | 11  |
>>
>> +-+-+
>>
>> wrong results. should be
>
>>
>>>
>>> +-+-+
>>
>> | ID  |  A  |
>>
>> +-+-+
>>
>> | 3   | 33  |
>>
>> | 2   | 22  |
>>
>> +-+-+
>>
>>  there may be some errors. ScanUtil.setupReverseScan code.
>
>


order by primary key desc return wrong results

2018-07-31 Thread jie chen
phoenix-4.14-hbase-1.2

0: jdbc:phoenix:localhost>  create table test(id bigint not null primary
>> key, a bigint);
>
> No rows affected (1.242 seconds)
>
> 0: jdbc:phoenix:localhost> upsert into test values(1,11);
>
> 1 row affected (0.01 seconds)
>
> 0: jdbc:phoenix:localhost> upsert into test values(2,22);
>
> 1 row affected (0.007 seconds)
>
> 0: jdbc:phoenix:localhost> upsert into test values(3,33);
>
> 1 row affected (0.005 seconds)
>
> 0: jdbc:phoenix:localhost> select * from test;
>
> +-+-+
>
> | ID  |  A  |
>
> +-+-+
>
> | 1   | 11  |
>
> | 2   | 22  |
>
> | 3   | 33  |
>
> +-+-+
>
> 3 rows selected (0.015 seconds)
>
> 0: jdbc:phoenix:localhost> select * from test order by id desc limit 2
>> offset 0;
>
> +-+-+
>
> | ID  |  A  |
>
> +-+-+
>
> | 3   | 33  |
>
> | 2   | 22  |
>
> +-+-+
>
> 2 rows selected (0.018 seconds)
>
> 0: jdbc:phoenix:localhost> select * from test where id in (select id from
>> test ) order by id desc limit 2 offset 0;
>
> +-+-+
>
> | ID  |  A  |
>
> +-+-+
>
> | 2   | 22  |
>
> | 1   | 11  |
>
> +-+-+
>
> wrong results. should be

>
>>
>> +-+-+
>
> | ID  |  A  |
>
> +-+-+
>
> | 3   | 33  |
>
> | 2   | 22  |
>
> +-+-+
>
>  there may be some errors. ScanUtil.setupReverseScan code.