Xinyi Yan created PHOENIX-6669:
----------------------------------
Summary: RVC returns a wrong result
Key: PHOENIX-6669
URL: https://issues.apache.org/jira/browse/PHOENIX-6669
Project: Phoenix
Issue Type: Bug
Affects Versions: 4.16.1
Reporter: Xinyi Yan
{code:java}
CREATE TABLE IF NOT EXISTS DUMMY (
PK1 VARCHAR NOT NULL,
PK2 BIGINT NOT NULL,
PK3 BIGINT NOT NULL,
PK4 VARCHAR NOT NULL,
COL1 BIGINT,
COL2 INTEGER,
COL3 VARCHAR,
COL4 VARCHAR, CONSTRAINT PK PRIMARY KEY
(
PK1,
PK2,
PK3,
PK4
)
);UPSERT INTO DUMMY (PK1, PK4, COL1, PK2, COL2, PK3, COL3, COL4)
VALUES ('xx', 'xid1', 0, 7, 7, 7, 'INSERT', null);
{code}
The non-RVC query returns no row, but the RVC query returns a wrong result.
{code:java}
0: jdbc:phoenix:localhost> select PK2
. . . . . . . . . . . . .> from DUMMY
. . . . . . . . . . . . .> where (PK1 = 'xx')
. . . . . . . . . . . . .> and ((PK2 > 5 AND PK2 <=5))
. . . . . . . . . . . . .> and ((PK3 > 2 AND PK3 <=2));
+------------------------------------------+
| PK2 |
+------------------------------------------+
+------------------------------------------+
No rows selected (0.022 seconds)
0: jdbc:phoenix:localhost> select PK2
. . . . . . . . . . . . .> from DUMMY
. . . . . . . . . . . . .> where (PK1 = 'xx')
. . . . . . . . . . . . .> and (PK1, PK2, PK3) > ('xx', 5, 2)
. . . . . . . . . . . . .> and (PK1, PK2, PK3) <= ('xx', 5, 2);
+------------------------------------------+
| PK2 |
+------------------------------------------+
| 7 |
+------------------------------------------+
1 row selected (0.033 seconds) {code}
{code:java}
0: jdbc:phoenix:localhost> EXPLAIN select PK2 from DUMMY where (PK1 = 'xx') and
(PK1, PK2, PK3) > ('xx', 5, 2) and (PK1, PK2, PK3) <= ('xx', 5, 2);
+------------------------------------------+------------------------------------------+------------------------------------------+--+
| PLAN | EST_BYTES_READ
| EST_ROWS_READ | |
+------------------------------------------+------------------------------------------+------------------------------------------+--+
| CLIENT 1-CHUNK PARALLEL 1-WAY ROUND ROBIN RANGE SCAN OVER DUMMY ['xx'] | null
| null |
| SERVER FILTER BY FIRST KEY ONLY | null
| null | |
+------------------------------------------+------------------------------------------+------------------------------------------+--+
2 rows selected (0.024 seconds)
0: jdbc:phoenix:localhost> EXPLAIN select PK2 from DUMMY where (PK1 = 'xx') and
((PK2 > 5 AND PK2 <=5)) and ((PK3 > 2 AND PK3 <=2));
+------------------------------------------+------------------------------------------+------------------------------------------+--+
| PLAN | EST_BYTES_READ
| EST_ROWS_READ | |
+------------------------------------------+------------------------------------------+------------------------------------------+--+
| DEGENERATE SCAN OVER DUMMY | null
| null | |
+------------------------------------------+------------------------------------------+------------------------------------------+--+
1 row selected (0.005 seconds) {code}
--
This message was sent by Atlassian Jira
(v8.20.1#820001)