ChinmaySKulkarni commented on a change in pull request #494: PHOENIX-5262 Wrong
Result on Salted table with Varbinary PK
URL: https://github.com/apache/phoenix/pull/494#discussion_r279581591
##########
File path:
phoenix-core/src/it/java/org/apache/phoenix/end2end/salted/SaltedTableVarLengthRowKeyIT.java
##########
@@ -87,4 +89,36 @@ public void testSelectValueWithPointKeyQuery() throws
Exception {
conn.close();
}
}
+
+ @Test
+ public void testSaltedVarbinaryUpperBoundQuery() throws Exception {
+ String tableName = generateUniqueName();
+ String ddl = "CREATE TABLE " + tableName +
+ " ( k VARBINARY PRIMARY KEY, a INTEGER ) SALT_BUCKETS = 3";
+ String dml = "UPSERT INTO " + tableName + " values (?, ?)";
+ String sql2 = "SELECT * FROM " + tableName + " WHERE k = ?";
+
+ try (Connection conn = DriverManager.getConnection(getUrl())) {
+ conn.createStatement().execute(ddl);
+ PreparedStatement stmt = conn.prepareStatement(dml);
+ stmt.setInt(2, 1);
+
+ stmt.setBytes(1, new byte[] { 5 });
+ stmt.executeUpdate();
+ stmt.setBytes(1, new byte[] { 5, 0 });
+ stmt.executeUpdate();
+ stmt.setBytes(1, new byte[] { 5, 1 });
+ stmt.executeUpdate();
+ conn.commit();
+
+ stmt = conn.prepareStatement(sql2);
+ stmt.setBytes(1, new byte[] { 5 });
+ ResultSet rs = stmt.executeQuery();
+
+ assertTrue(rs.next());
+ assertArrayEquals(new byte[] {5},rs.getBytes(1));
+ assertEquals(1,rs.getInt(2));
+ assertFalse(rs.next());
+ }
Review comment:
nit: close the statment
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services