Skip to content

Commit

Permalink
Split testInsertUnicode into two tests
Browse files Browse the repository at this point in the history
U+10FFF is not considered a valid unicode character in some systems
  • Loading branch information
hashhar committed Oct 28, 2021
1 parent 39ecf23 commit e18410b
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2985,6 +2985,13 @@ public void testNullPartitionValues()
assertUpdate("DROP TABLE test_null_partition");
}

@Test
@Override
public void testInsertHighestUnicodeCharacter()
{
throw new SkipException("Covered by testInsertUnicode");
}

@Test
@Override
public void testInsertUnicode()
Expand All @@ -2997,6 +3004,7 @@ private void testInsertUnicode(Session session, HiveStorageFormat storageFormat)
assertUpdate(session, "DROP TABLE IF EXISTS test_insert_unicode");
assertUpdate(session, "CREATE TABLE test_insert_unicode(test varchar) WITH (format = '" + storageFormat + "')");

// Test with U+10FFF to cover testInsertHighestUnicodeCharacter
assertUpdate("INSERT INTO test_insert_unicode(test) VALUES 'Hello', U&'hello\\6d4B\\8Bd5\\+10FFFFworld\\7F16\\7801' ", 2);
assertThat(computeActual("SELECT test FROM test_insert_unicode").getOnlyColumnAsSet())
.containsExactlyInAnyOrder("Hello", "hello测试􏿿world编码");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,13 @@ public void testInsertUnicode()
throw new SkipException("TODO");
}

@Override
public void testInsertHighestUnicodeCharacter()
{
// TODO Support these test once kudu connector can create tables with default partitions
throw new SkipException("TODO");
}

@Override
public void testDropNonEmptySchema()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,13 @@ public void testInsertUnicode()
throw new SkipException("MemSQL doesn't support utf8mb4");
}

@Override
public void testInsertHighestUnicodeCharacter()
{
// MemSQL's utf8 encoding is 3 bytes and truncates strings upon encountering a 4 byte sequence
throw new SkipException("MemSQL doesn't support utf8mb4");
}

@Test
public void testDropTable()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -573,9 +573,9 @@ public void testInsertUnicode()
String tableName = "test_insert_unicode_" + randomTableSuffix();

assertUpdate("CREATE TABLE " + tableName + "(test varchar(50))");
assertUpdate("INSERT INTO " + tableName + "(test) VALUES 'Hello', U&'hello\\6d4B\\8Bd5\\+10FFFFworld\\7F16\\7801' ", 2);
assertUpdate("INSERT INTO " + tableName + "(test) VALUES 'Hello', U&'hello\\6d4B\\8Bd5world\\7F16\\7801' ", 2);
assertThat(computeActual("SELECT test FROM " + tableName).getOnlyColumnAsSet())
.containsExactlyInAnyOrder("Hello", "hello测试􏿿world编码");
.containsExactlyInAnyOrder("Hello", "hello测试world编码");
assertUpdate("DROP TABLE " + tableName);

assertUpdate("CREATE TABLE " + tableName + "(test varchar(50))");
Expand All @@ -597,6 +597,20 @@ public void testInsertUnicode()
assertUpdate("DROP TABLE " + tableName);
}

@Test
public void testInsertHighestUnicodeCharacter()
{
skipTestUnless(supportsInsert());

String tableName = "test_insert_unicode_" + randomTableSuffix();

assertUpdate("CREATE TABLE " + tableName + "(test varchar(50))");
assertUpdate("INSERT INTO " + tableName + "(test) VALUES 'Hello', U&'hello\\6d4B\\8Bd5\\+10FFFFworld\\7F16\\7801' ", 2);
assertThat(computeActual("SELECT test FROM " + tableName).getOnlyColumnAsSet())
.containsExactlyInAnyOrder("Hello", "hello测试􏿿world编码");
assertUpdate("DROP TABLE " + tableName);
}

@Test
public void testInsertArray()
{
Expand Down

0 comments on commit e18410b

Please sign in to comment.