Uploaded image for project: 'Phoenix'
  1. Phoenix
  2. PHOENIX-4642

Select from local index in backward direction returns only from last region.

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Cannot Reproduce
    • 4.11.0
    • None
    • None
    • None
    • Amazon EMR HBase 1.3 Phoenix 4.11 .

    Description

      I have a table:

      CREATE TABLE IF NOT EXISTS PRODUCT_HISTORY_2 (                                                                                                                                                                                         
          ts BIGINT NOT NULL,                                                                                                 
          id VARCHAR NOT NULL,                                                                                                
          merchantId VARCHAR,                                                                                                 
          storeId VARCHAR,                                                                                                    
          a.product VARCHAR,                                                                                                  
          CONSTRAINT pk PRIMARY KEY(ts, id)                                                                                   
      ) COMPRESSION=GZ,VERSIONS=2,UPDATE_CACHE_FREQUENCY=1000,APPEND_ONLY_SCHEMA=true,IMMUTABLE_ROWS=true;                    
                                                                                                                              
      CREATE LOCAL INDEX IF NOT EXISTS PRODUCT_HISTORY_2_ID_TS ON PRODUCT_HISTORY_2 (                                         
          id, ts                                                                                                              
      ) COMPRESSION=GZ;
      

      It is large enough to be splitted into 16 regions.
      Now I want to select alll items by id:

      0: jdbc:phoenix:localhost:2181:/hbase> select id, ts from product_history_2 where id = '1491199695565244581-139-1-582-3894176988' order by ts;
      +-------------------------------------------+----------------+
      |                    ID                     |       TS       |
      +-------------------------------------------+----------------+
      | 1491199695565244581-139-1-582-3894176988  | 1498709133486  |
      | 1491199695565244581-139-1-582-3894176988  | 1498810584706  |
      | 1491199695565244581-139-1-582-3894176988  | 1499083503309  |
      | 1491199695565244581-139-1-582-3894176988  | 1499170817262  |
      | 1491199695565244581-139-1-582-3894176988  | 1503663938614  |
      | 1491199695565244581-139-1-582-3894176988  | 1506596564228  |
      | 1491199695565244581-139-1-582-3894176988  | 1509714911254  |
      | 1491199695565244581-139-1-582-3894176988  | 1517514069109  |
      +-------------------------------------------+----------------+
      8 rows selected (0,107 seconds)
      

      And now I want to fetch same rows, but with time descending:

      0: jdbc:phoenix:localhost:2181:/hbase> select id, ts from product_history_2 where id = '1491199695565244581-139-1-582-3894176988' order by ts desc;
      +-------------------------------------------+----------------+
      |                    ID                     |       TS       |
      +-------------------------------------------+----------------+
      | 1491199695565244581-139-1-582-3894176988  | 1517514069109  |
      | 1491199695565244581-139-1-582-3894176988  | 1509714911254  |
      +-------------------------------------------+----------------+
      2 rows selected (0,048 seconds)
      

      Ooops, where are other 6 rows?

      Both queries uses local index:

      0: jdbc:phoenix:localhost:2181:/hbase> explain select id, ts from product_history_2 where id = '1491199695565244581-139-1-582-3894176988' order by ts;
      +--------------------------------------------------------------------------------------------------------------------------------------------------+-----------------+----------------+
      |                                                                       PLAN                                                                       | EST_BYTES_READ  | EST_ROWS_READ  |
      +--------------------------------------------------------------------------------------------------------------------------------------------------+-----------------+----------------+
      | CLIENT 14-CHUNK 34026740 ROWS 4089447171 BYTES PARALLEL 14-WAY RANGE SCAN OVER PRODUCT_HISTORY_2 [1,'1491199695565244581-139-1-582-3894176988']  | null            | null           |
      |     SERVER FILTER BY FIRST KEY ONLY                                                                                                              | null            | null           |
      | CLIENT MERGE SORT                                                                                                                                | null            | null           |
      +--------------------------------------------------------------------------------------------------------------------------------------------------+-----------------+----------------+
      3 rows selected (0,024 seconds)
      0: jdbc:phoenix:localhost:2181:/hbase> explain select id, ts from product_history_2 where id = '1491199695565244581-139-1-582-3894176988' order by ts desc;
      +----------------------------------------------------------------------------------------------------------------------------------------------------------+-----------------+----------------+
      |                                                                           PLAN                                                                           | EST_BYTES_READ  | EST_ROWS_READ  |
      +----------------------------------------------------------------------------------------------------------------------------------------------------------+-----------------+----------------+
      | CLIENT 14-CHUNK 34026740 ROWS 4089447171 BYTES PARALLEL 14-WAY REVERSE RANGE SCAN OVER PRODUCT_HISTORY_2 [1,'1491199695565244581-139-1-582-3894176988']  | null            | null           |
      |     SERVER FILTER BY FIRST KEY ONLY                                                                                                                      | null            | null           |
      | CLIENT MERGE SORT                                                                                                                                        | null            | null           |
      +----------------------------------------------------------------------------------------------------------------------------------------------------------+-----------------+----------------+
      3 rows selected (0,018 seconds)
      

      Possibly related bugs are : PHOENIX-3898 and PHOENIX-4292
      Unfortunately I can no test phoenix 4.13 yet.

      Attachments

        Activity

          People

            Unassigned Unassigned
            funny_falcon Sokolov Yura
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: