phoenix-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jie chen <chji...@gmail.com>
Subject order by primary key desc return wrong results
Date Tue, 31 Jul 2018 08:12:17 GMT
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.

Mime
View raw message