You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@phoenix.apache.org by "Daniel Wong (Jira)" <ji...@apache.org> on 2020/07/15 21:52:00 UTC

[jira] [Updated] (PHOENIX-5924) RVC Offset does not handle variable length fields exclusive scan boundary correctly

     [ https://issues.apache.org/jira/browse/PHOENIX-5924?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Daniel Wong updated PHOENIX-5924:
---------------------------------
    Attachment:     (was: PHOENIX-5924-4.x.patch)

> RVC Offset does not handle variable length fields exclusive scan boundary correctly
> -----------------------------------------------------------------------------------
>
>                 Key: PHOENIX-5924
>                 URL: https://issues.apache.org/jira/browse/PHOENIX-5924
>             Project: Phoenix
>          Issue Type: Bug
>    Affects Versions: 5.0.0, 4.15.0, 4.14.3
>            Reporter: Daniel Wong
>            Assignee: Daniel Wong
>            Priority: Major
>             Fix For: 5.1.0, 4.16.0
>
>         Attachments: PHOENIX-5924-4.x.patch
>
>          Time Spent: 0.5h
>  Remaining Estimate: 0h
>
> The way exclusive boundary was handled by incrementing the key for variable length fields is incorrect in the scan boundary.
>  
> In the following case we incrementing incorrectly from 0x490049 -> 0x490050 ('1','1' -> '1','2')
> We should increment from 0x490049 -> 0x49004900 ('1','1' -> '1','1'\x00) 
> @Test
> public void testScenario() throws Exception \{
>     String TEST_DDL = "CREATE TABLE IF NOT EXISTS TEST_SCHEMA (\n"
>             + "    ORGANIZATION_ID VARCHAR(15), \n" + "    TEST_ID VARCHAR(15), \n"
>             + "    CREATED_DATE DATE, \n" + "    LAST_UPDATE DATE\n"
>             + "    CONSTRAINT TEST_SCHEMA_PK PRIMARY KEY (ORGANIZATION_ID, TEST_ID) \n" + ")";
>     try (Statement statement = conn.createStatement()) {
>         statement.execute(TEST_DDL);
>     }
>     //setup
>     List<String> upserts = new ArrayList<>();
>     upserts.add("UPSERT INTO TEST_SCHEMA(ORGANIZATION_ID,TEST_ID) VALUES ('1','1')");
>     upserts.add("UPSERT INTO TEST_SCHEMA(ORGANIZATION_ID,TEST_ID) VALUES ('1','10')");
>     upserts.add("UPSERT INTO TEST_SCHEMA(ORGANIZATION_ID,TEST_ID) VALUES ('2','2')");
>     for(String sql : upserts) \{
>         try (Statement statement = conn.createStatement()) {
>             statement.execute(sql);
>         }
>     }
>     conn.commit();
>     String query1 = "SELECT * FROM TEST_SCHEMA";
>     String query2 = "SELECT * FROM TEST_SCHEMA OFFSET (ORGANIZATION_ID,TEST_ID) = ('1','1')";
>     try (Statement statement = conn.createStatement() ; ResultSet rs1 = statement.executeQuery(query1) ) \{
>         TestUtil.printResultSet(rs1);
>     }
>     try (Statement statement = conn.createStatement() ; ResultSet rs2 = statement.executeQuery(query2) ) \{
>         TestUtil.printResultSet(rs2);
>     }
> }
>  



--
This message was sent by Atlassian Jira
(v8.3.4#803005)