You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@phoenix.apache.org by ja...@apache.org on 2015/07/08 21:00:02 UTC
[2/2] phoenix git commit: PHOENIX-2097 Add new MD5 test for composite
PK
PHOENIX-2097 Add new MD5 test for composite PK
Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo
Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/69e55df8
Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/69e55df8
Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/69e55df8
Branch: refs/heads/master
Commit: 69e55df8ff42aedf8c12da569dc5e85cc13eb95d
Parents: efb941a
Author: James Taylor <jt...@salesforce.com>
Authored: Thu Jul 2 10:03:55 2015 -0700
Committer: James Taylor <jt...@salesforce.com>
Committed: Wed Jul 8 11:57:40 2015 -0700
----------------------------------------------------------------------
.../apache/phoenix/end2end/MD5FunctionIT.java | 19 +++++++++++++++++++
1 file changed, 19 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/phoenix/blob/69e55df8/phoenix-core/src/it/java/org/apache/phoenix/end2end/MD5FunctionIT.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/MD5FunctionIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/MD5FunctionIT.java
index ff7ebdb..a6107df 100644
--- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/MD5FunctionIT.java
+++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/MD5FunctionIT.java
@@ -52,6 +52,25 @@ public class MD5FunctionIT extends BaseHBaseManagedTimeIT {
}
@Test
+ public void testRetrieveCompositeKey() throws Exception {
+ String testString = "FOOBAR";
+
+ Connection conn = DriverManager.getConnection(getUrl());
+ String ddl = "CREATE TABLE IF NOT EXISTS MD5_RETRIEVE_TEST (k1 CHAR(3) NOT NULL, k2 CHAR(3) NOT NULL, CONSTRAINT PK PRIMARY KEY (K1,K2))";
+ conn.createStatement().execute(ddl);
+ String dml = "UPSERT INTO MD5_RETRIEVE_TEST VALUES('FOO','BAR')";
+ conn.createStatement().execute(dml);
+ conn.commit();
+
+ ResultSet rs = conn.createStatement().executeQuery("SELECT MD5((K1,K2)) FROM MD5_RETRIEVE_TEST");
+ assertTrue(rs.next());
+ byte[] first = MessageDigest.getInstance("MD5").digest(testString.getBytes());
+ byte[] second = rs.getBytes(1);
+ assertArrayEquals(first, second);
+ assertFalse(rs.next());
+ }
+
+ @Test
public void testUpsert() throws Exception {
String testString1 = "mwalsh1";
String testString2 = "mwalsh2";