PHOENIX-3396 Valid Multi-byte strings whose total byte size is greater than the max char limit cannot be inserted into VARCHAR fields in the PK
Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/6ef3a3f0 Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/6ef3a3f0 Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/6ef3a3f0 Branch: refs/heads/encodecolumns2 Commit: 6ef3a3f04597df0404601437e6ba17aa7f4f46e5 Parents: 030fb76 Author: James Taylor <jamestay...@apache.org> Authored: Fri Oct 28 08:59:13 2016 -0700 Committer: James Taylor <jamestay...@apache.org> Committed: Fri Oct 28 17:23:29 2016 -0700 ---------------------------------------------------------------------- .../src/test/java/org/apache/phoenix/schema/MutationTest.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/phoenix/blob/6ef3a3f0/phoenix-core/src/test/java/org/apache/phoenix/schema/MutationTest.java ---------------------------------------------------------------------- diff --git a/phoenix-core/src/test/java/org/apache/phoenix/schema/MutationTest.java b/phoenix-core/src/test/java/org/apache/phoenix/schema/MutationTest.java index ce2e22f..e0f48c0 100644 --- a/phoenix-core/src/test/java/org/apache/phoenix/schema/MutationTest.java +++ b/phoenix-core/src/test/java/org/apache/phoenix/schema/MutationTest.java @@ -83,8 +83,9 @@ public class MutationTest extends BaseConnectionlessQueryTest { conn.setAutoCommit(false); String bvalue = "01234567890123456789"; assertEquals(20,PVarchar.INSTANCE.toBytes(bvalue).length); - String value = "æ¾´ç²è¤à¤¯è¤»é 岤豦íè°é©è¼Õªë¦ç¢ç¢ç¢ç¢ç¢ç¢"; - assertTrue(value.length() <= maxLength2 && value.getBytes().length > maxLength2); + String value = "æ¾´ç²è¤à¤¯è¤»é 岤豦íè°é©è¼Õªë¦ç¢ç¢ç¢ç¢ç¢"; + assertTrue(value.length() <= maxLength2); + assertTrue(PVarchar.INSTANCE.toBytes(value).length > maxLength2); conn.createStatement().execute("CREATE TABLE t1 (k1 char(" + maxLength1 + ") not null, k2 varchar(" + maxLength2 + "), " + "v1 varchar(" + maxLength2 + "), v2 varbinary(" + maxLength2 + "), v3 binary(" + maxLength2 + "), constraint pk primary key (k1, k2))"); conn.createStatement().execute("UPSERT INTO t1 VALUES('a','" + value + "', '" + value + "','" + bvalue + "','" + bvalue + "')");