Palash Chauhan created PHOENIX-7760:
---------------------------------------
Summary: Scan startRow can be incorrect when an RVC with GREATER
operator is combined with an overlapping constraint on the leading column in
the RVC
Key: PHOENIX-7760
URL: https://issues.apache.org/jira/browse/PHOENIX-7760
Project: Phoenix
Issue Type: Bug
Affects Versions: 5.3.0
Reporter: Palash Chauhan
{code:java}
CREATE TABLE test_table (
hk VARCHAR NOT NULL,
sk VARCHAR NOT NULL,
ihk VARCHAR,
isk VARCHAR,
data VARCHAR
CONSTRAINT pk PRIMARY KEY (hk, sk, ihk, isk)
);{code}
{code:java}
-- Insert 20 rows with isk = isk01 through isk20
UPSERT INTO test_table VALUES ('hk', 'sk100', 'idx', 'isk01', 'data01');
UPSERT INTO test_table VALUES ('hk', 'sk100', 'idx', 'isk02', 'data01');
..
UPSERT INTO test_table VALUES ('hk', 'sk100', 'idx', 'isk20', 'data01');{code}
{code:java}
-- This query WORKS correctly (returns rows after isk11):
-- Scan "startRow":"hk\\x00sk100\\x00idx\\x00isk11\\x01"
-- filter on non-PK row also works fine
SELECT * FROM test_table
WHERE hk = 'hk'
AND (sk, ihk, isk) > ('sk100', 'idx', 'isk11')
ORDER BY sk, ihk, isk LIMIT 5;{code}
{code:java}
-- This query FAILS (incorrectly includes row with isk11):
-- Scan "startRow":"hk\\x00sk100\\x00idx\\x00isk11"
SELECT * FROM test_table
WHERE hk = 'hk'
AND sk <= 'sk200'
AND (sk, ihk, isk) > ('sk100', 'idx', 'isk11')
ORDER BY sk, ihk, isk LIMIT 5;
{code}
--
This message was sent by Atlassian Jira
(v8.20.10#820010)