[ 
https://issues.apache.org/jira/browse/PHOENIX-2769?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15198758#comment-15198758
 ] 

Joseph Sun commented on PHOENIX-2769:
-------------------------------------

I execute some sql ,the problem is reproduced.


> select count(0) from access_logs;
+-----------+
| COUNT(0)  |
+-----------+
| 1458242   |
+-----------+

> explain select * from access_logs order by event_time desc limit 10;
+-----------------------------------------------------------------+
|                              PLAN                               |
+-----------------------------------------------------------------+
| CLIENT 6-CHUNK SERIAL 6-WAY REVERSE FULL SCAN OVER ACCESS_LOGS  |
|     SERVER 10 ROW LIMIT                                         |
| CLIENT MERGE SORT                                               |
| CLIENT 10 ROW LIMIT                                             |
+-----------------------------------------------------------------+

> UPDATE STATISTICS access_logs;
No rows affected (6.634 seconds)

> explain select * from access_logs order by event_time desc limit 10;
+-----------------------------------------------------------------+
|                              PLAN                               |
+-----------------------------------------------------------------+
| CLIENT 6-CHUNK SERIAL 6-WAY REVERSE FULL SCAN OVER ACCESS_LOGS  |
|     SERVER 10 ROW LIMIT                                         |
| CLIENT MERGE SORT                                               |
| CLIENT 10 ROW LIMIT                                             |
+-----------------------------------------------------------------+

> execute some sql

> explain select * from access_logs order by event_time desc limit 10;
+------------------------------------------------------------------------------------------------+
|                                              PLAN                             
                 |
+------------------------------------------------------------------------------------------------+
| CLIENT 24-CHUNK 1408646 ROWS 5662311262 BYTES SERIAL 6-WAY REVERSE FULL SCAN 
OVER ACCESS_LOGS  |
|     SERVER 10 ROW LIMIT                                                       
                 |
| CLIENT MERGE SORT                                                             
                 |
| CLIENT 10 ROW LIMIT                                                           
                 |
+------------------------------------------------------------------------------------------------+



> select * from access_logs order by event_time desc limit 10;
now the wrong results is return.



> Order by desc return wrong results
> ----------------------------------
>
>                 Key: PHOENIX-2769
>                 URL: https://issues.apache.org/jira/browse/PHOENIX-2769
>             Project: Phoenix
>          Issue Type: Bug
>    Affects Versions: 4.6.0, 4.7.0
>         Environment: 3  centos servers
>            Reporter: Joseph Sun
>              Labels: test
>
> create table access_logs (
>       event_time date not null,
>       uuid varchar(36) not null,
>       event_type varchar(32),
>       CONSTRAINT pk PRIMARY KEY (event_time,uuid)
> ) VERSIONS=1,SALT_BUCKETS=6,IMMUTABLE_ROWS=true;
> I insert 2,000,000 records to access_logs ,and event_time between 2016-01-06  
> to 2016-03-15 .
> I execute SQL. 
> >select event_time from access_logs  order by event_time asc limit 10;
> +--------------------------+
> |        EVENT_TIME        |
> +--------------------------+
> | 2016-01-06 18:41:54.000  |
> | 2016-01-06 19:56:46.000  |
> | 2016-01-06 20:25:12.000  |
> | 2016-01-06 20:41:37.000  |
> | 2016-01-06 20:46:20.000  |
> | 2016-01-06 20:53:10.000  |
> | 2016-01-06 21:04:09.000  |
> | 2016-01-07 01:22:57.000  |
> | 2016-01-07 10:59:11.000  |
> | 2016-01-07 12:52:56.000  |
> +--------------------------+
>  
> > select event_time from access_logs order by event_time desc limit 10;
> +--------------------------+
> |        EVENT_TIME        |
> +--------------------------+
> | 2016-02-11 13:07:25.000  |
> | 2016-02-11 13:07:24.000  |
> | 2016-02-11 13:07:24.000  |
> | 2016-02-11 13:07:23.000  |
> | 2016-02-11 13:07:23.000  |
> | 2016-02-11 13:07:22.000  |
> | 2016-02-11 13:07:21.000  |
> | 2016-02-11 13:07:21.000  |
> | 2016-02-11 13:07:20.000  |
> | 2016-02-11 13:07:20.000  |
> > select event_time from access_logs where event_time>to_date('2016-02-11 
> > 13:07:25') order by event_time desc limit 10;
> +--------------------------+
> |        EVENT_TIME        |
> +--------------------------+
> | 2016-02-25 18:34:17.000  |
> | 2016-02-25 18:34:17.000  |
> | 2016-02-25 18:34:16.000  |
> | 2016-02-25 18:34:16.000  |
> | 2016-02-25 18:34:15.000  |
> | 2016-02-25 18:34:15.000  |
> | 2016-02-25 18:34:14.000  |
> | 2016-02-25 18:34:14.000  |
> | 2016-02-25 18:34:14.000  |
> | 2016-02-25 18:34:14.000  |
> +--------------------------+
> Check the return results ,the 'order by event_time desc' is not return 
> correct results.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to