phoenix-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Samarth Jain (JIRA)" <j...@apache.org>
Subject [jira] [Updated] (PHOENIX-1140) IN LIST of RVCs doesn't return rows when the column values of fixed width types have a smaller length than the length specified in schema
Date Fri, 01 Aug 2014 08:32:38 GMT

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

Samarth Jain updated PHOENIX-1140:
----------------------------------

    Attachment: PHOENIX-1140_3.0.patch

[~jamestaylor] - please review and commit. The patch works for all branches. Thanks!

> IN LIST of RVCs doesn't return rows when the column values of fixed width types have
a smaller length than the length specified in schema
> -----------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: PHOENIX-1140
>                 URL: https://issues.apache.org/jira/browse/PHOENIX-1140
>             Project: Phoenix
>          Issue Type: Bug
>            Reporter: Samarth Jain
>            Assignee: Samarth Jain
>             Fix For: 5.0.0, 3.1, 4.1
>
>         Attachments: PHOENIX-1140_3.0.patch
>
>
> {code}
> @Test 
>     public void testInListOfRVC6() throws Exception {
>         String tenantId = "ABC";
>         String tableDDL = "CREATE TABLE t (tenantId char(15) NOT NULL, pk2 char(15) NOT
NULL, pk3 INTEGER NOT NULL, c1 INTEGER constraint pk primary key (tenantId,pk2,pk3))";
>         createTestTable(getUrl(), tableDDL, null, nextTimestamp());
>         Connection conn = nextConnection(getUrl());
>         conn.createStatement().executeUpdate("upsert into t (tenantId, pk2, pk3, c1)
values ('ABC', 'hel1', 1, 1)");
>         conn.createStatement().executeUpdate("upsert into t (tenantId, pk2, pk3, c1)
values ('ABC', 'hel2', 2, 2)");
>         conn.createStatement().executeUpdate("upsert into t (tenantId, pk2, pk3, c1)
values ('ABC', 'hel3', 3, 3)");
>         conn.createStatement().executeUpdate("upsert into t (tenantId, pk2, pk3, c1)
values ('ABC', 'hel4', 4, 4)");
>         conn.createStatement().executeUpdate("upsert into t (tenantId, pk2, pk3, c1)
values ('ABC', 'hel5', 5, 5)");
>         conn.commit();
>         conn.close();
>         conn = nextConnection(getUrl());
>         //order by needed on the query to make the order of rows returned deterministic.
>         PreparedStatement stmt = conn.prepareStatement("select pk2, pk3 from t WHERE
(tenantId, pk2, pk3) IN ((?, ?, ?), (?, ?, ?))");
>         stmt.setString(1, tenantId);
>         stmt.setString(2, "hel3");
>         stmt.setInt(3, 3);
>         stmt.setString(4, tenantId);
>         stmt.setString(5, "hel5");
>         stmt.setInt(6, 5);
>         ResultSet rs = stmt.executeQuery();
>         assertTrue(rs.next());
>         assertEquals("hel3", rs.getString(1));
>         assertEquals(3, rs.getInt(2));
>         assertTrue(rs.next());
>         assertEquals("hel5", rs.getString(1));
>         assertEquals(5, rs.getInt(2));
>         conn.close();
>     }
> {code}



--
This message was sent by Atlassian JIRA
(v6.2#6252)

Mime
View raw message