You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@phoenix.apache.org by "James Taylor (JIRA)" <ji...@apache.org> on 2014/08/04 08:13:12 UTC
[jira] [Updated] (PHOENIX-1140) Incorrect padding for row key
columns
[ https://issues.apache.org/jira/browse/PHOENIX-1140?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
James Taylor updated PHOENIX-1140:
----------------------------------
Summary: Incorrect padding for row key columns (was: 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)
> Incorrect padding for row key columns
> -------------------------------------
>
> 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)