You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@phoenix.apache.org by "Yunbo Fan (Jira)" <ji...@apache.org> on 2023/05/19 03:29:00 UTC

[jira] [Created] (PHOENIX-6960) Scan range is wrong when query desc columns

Yunbo Fan created PHOENIX-6960:
----------------------------------

             Summary: Scan range is wrong when query desc columns
                 Key: PHOENIX-6960
                 URL: https://issues.apache.org/jira/browse/PHOENIX-6960
             Project: Phoenix
          Issue Type: Bug
    Affects Versions: 5.1.3
            Reporter: Yunbo Fan


Ways to reproduce
{code}
0: jdbc:phoenix:> create table sts(id integer primary key, name varchar, type integer, status integer);
No rows affected (1.259 seconds)
0: jdbc:phoenix:> create index sts_name_desc on sts(status, type desc, name desc);
^[[ANo rows affected (6.376 seconds)
0: jdbc:phoenix:> create index sts_name_asc on sts(type desc, name) include (status);
No rows affected (6.377 seconds)
0: jdbc:phoenix:> upsert into sts values(1, 'test10.txt', 1, 1);
1 row affected (0.026 seconds)
0: jdbc:phoenix:>
0: jdbc:phoenix:>
0: jdbc:phoenix:> explain select * from sts where type = 1 and name like 'test10%';
+------------------------------------------------------------------------------------------------------+----------------+---------------+-------------+
|                                                 PLAN                                                 | EST_BYTES_READ | EST_ROWS_READ | EST_INFO_TS |
+------------------------------------------------------------------------------------------------------+----------------+---------------+-------------+
| CLIENT 1-CHUNK PARALLEL 1-WAY ROUND ROBIN RANGE SCAN OVER STS_NAME_ASC [~1,'test10'] - [~1,'test11'] | null           | null          | null        |
+------------------------------------------------------------------------------------------------------+----------------+---------------+-------------+
1 row selected (0.023 seconds)
0: jdbc:phoenix:> select * from sts where type = 1 and name like 'test10%';
+----+------------+------+--------+
| ID |    NAME    | TYPE | STATUS |
+----+------------+------+--------+
| 1  | test10.txt | 1    | 1      |
+----+------------+------+--------+
1 row selected (0.033 seconds)
0: jdbc:phoenix:> explain select * from sts where status = 1 and type = 1 and name like 'test10%';
+-------------------------------------------------------------------------------------------------------------+----------------+---------------+-------------+
|                                                    PLAN                                                     | EST_BYTES_READ | EST_ROWS_READ | EST_INFO_TS |
+-------------------------------------------------------------------------------------------------------------+----------------+---------------+-------------+
| CLIENT 1-CHUNK PARALLEL 1-WAY ROUND ROBIN RANGE SCAN OVER STS_NAME_DESC [1,~1,~'test10'] - [1,~1,~'test1/'] | null           | null          | null        |
|     SERVER FILTER BY FIRST KEY ONLY AND "NAME" LIKE 'test10%'                                               | null           | null          | null        |
+-------------------------------------------------------------------------------------------------------------+----------------+---------------+-------------+
2 rows selected (0.022 seconds)
0: jdbc:phoenix:> select * from sts where status = 1 and type = 1 and name like 'test10%';
+----+------+------+--------+
| ID | NAME | TYPE | STATUS |
+----+------+------+--------+
+----+------+------+--------+
No rows selected (0.04 seconds)
{code}



--
This message was sent by Atlassian Jira
(v8.20.10#820010)