You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@phoenix.apache.org by "Istvan Toth (Jira)" <ji...@apache.org> on 2023/03/24 16:59:00 UTC

[jira] [Commented] (PHOENIX-6669) RVC returns a wrong result

    [ https://issues.apache.org/jira/browse/PHOENIX-6669?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17704713#comment-17704713 ] 

Istvan Toth commented on PHOENIX-6669:
--------------------------------------

This is a straight fix, so I have backported it to 5.1 now.

> 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
>            Assignee: Gokcen Iskender
>            Priority: Major
>             Fix For: 5.2.0
>
>
> {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 (PK1 > 'xx' AND 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 (PK1 > 'xx' AND 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.015 seconds){code}



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