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

Incorrect results with RVCs and AND operator

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Critical
    • Resolution: Fixed
    • 4.15.0
    • 5.2.0, 5.1.4
    • core
    • None

    Description

      Phoenix version: 4.15-HBase-1.5

      – Create a test table and populate a couple of rows.

      create table repro_bug(a varchar(10) not null, b varchar(10) not null, c varchar(10) not null constraint pk primary key(a, b, c));
      upsert into repro_bug values('abc', 'def', 'RRSQ_IMKKL');
      upsert into repro_bug values('abc', 'def', 'RRS_ZYTDT');
      select * from repro_bug;
      +------+------+-------------+
      |  A   |  B   |      C      |
      +------+------+-------------+
      | abc  | def  | RRSQ_IMKKL  |
      | abc  | def  | RRS_ZYTDT   |
      +------+------+-------------+
      

      – Query 1 - Look for rows where C has a certain prefix - Returns correct result

      select A, B, C from REPRO_BUG where C like 'RRS\\_%';
      +------+------+------------+
      |  A   |  B   |     C      |
      +------+------+------------+
      | abc  | def  | RRS_ZYTDT  |
      +------+------+------------+
      

      – Query 2 - Look for rows where (a, b, c) > first row - Returns correct result

      select A, B, C from REPRO_BUG where (A, B, C) > ('abc', 'def', 'RRSQ_IMKKL')
      +------+------+------------+
      |  A   |  B   |     C      |
      +------+------+------------+
      | abc  | def  | RRS_ZYTDT  |
      +------+------+------------+
      

      – Query 3 - Combine the filters from Query 1 and Query2 - Returns incorrect result.. Ideally it should return the same row as above.

       select A, B, C from REPRO_BUG where (A, B, C) > ('abc', 'def', 'RRSQ_IMKKL') AND C like 'RRS\\_%';
      +----+----+----+
      | A  | B  | C  |
      +----+----+----+
      +----+----+----+
      

      – Explain for the above incase someone is interested.

      explain select A, B, C from REPRO_BUG where (A, B, C) > ('abc', 'def', 'RRSQ_IMKKL') AND C like 'RRS\\_%';
      +----------------------------------------------------------------------------------------+-----------------+----------------+--------------+
      |                                          PLAN                                          | EST_BYTES_READ  | EST_ROWS_READ  | EST_INFO_TS  |
      +----------------------------------------------------------------------------------------+-----------------+----------------+--------------+
      | CLIENT 1-CHUNK PARALLEL 1-WAY ROUND ROBIN RANGE SCAN OVER REPRO_BUG ['abcdef'] - [*]  | null            | null           | null         |
      |     SERVER FILTER BY FIRST KEY ONLY AND C LIKE 'RRS\_%'                                | null            | null           | null         |
      +----------------------------------------------------------------------------------------+-----------------+----------------+--------------+
      2 rows selected (0.003 seconds)
      

      I'm trying to poke around in the code to figure out the issue but my understanding of Phoenix is limited at this point. So creating a bug report incase someone can figure this out quickly.

      Attachments

        1. PHOENIX-5833.4.x.patch
          9 kB
          Daniel Wong

        Activity

          People

            stoty Istvan Toth
            bharathv Bharath Vissapragada
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Time Tracking

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Remaining Estimate - 0h
                0h
                Logged:
                Time Spent - 20m
                20m