From issues-return-6407-archive-asf-public=cust-asf.ponee.io@phoenix.apache.org Tue Apr 30 01:00:29 2019 Return-Path: X-Original-To: archive-asf-public@cust-asf.ponee.io Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [207.244.88.153]) by mx-eu-01.ponee.io (Postfix) with SMTP id CF0C518061A for ; Tue, 30 Apr 2019 03:00:28 +0200 (CEST) Received: (qmail 39063 invoked by uid 500); 30 Apr 2019 01:00:28 -0000 Mailing-List: contact issues-help@phoenix.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@phoenix.apache.org Delivered-To: mailing list issues@phoenix.apache.org Received: (qmail 39054 invoked by uid 99); 30 Apr 2019 01:00:28 -0000 Received: from ec2-52-202-80-70.compute-1.amazonaws.com (HELO gitbox.apache.org) (52.202.80.70) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 30 Apr 2019 01:00:28 +0000 From: GitBox To: issues@phoenix.apache.org Subject: [GitHub] [phoenix] dbwong commented on a change in pull request #494: PHOENIX-5262 Wrong Result on Salted table with Varbinary PK Message-ID: <155658602311.30565.2970521895784961171.gitbox@gitbox.apache.org> Date: Tue, 30 Apr 2019 01:00:23 -0000 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit dbwong 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_r279589929 ########## 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: Done ---------------------------------------------------------------- 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: users@infra.apache.org With regards, Apache Git Services