Skip to content

Commit

Permalink
Test clearing Iceberg table comment
Browse files Browse the repository at this point in the history
It looks like before the change the assertions and table setup were
mixed a bit, and effectively clearing table comment was not tested.
  • Loading branch information
findepi committed Oct 22, 2021
1 parent c4368dd commit 955b7c1
Showing 1 changed file with 11 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -613,6 +613,13 @@ public void testTableComments()
"WITH (\n" +
format(" format = '%s'\n", format) +
")";
String createTableWithoutComment = "" +
"CREATE TABLE iceberg.tpch.test_table_comments (\n" +
" _x bigint\n" +
")\n" +
"WITH (\n" +
" format = '%s'\n" +
")";
@Language("SQL") String createTableSql = format(createTableTemplate, "test table comment", format);
assertUpdate(createTableSql);
MaterializedResult resultOfCreate = computeActual("SHOW CREATE TABLE test_table_comments");
Expand All @@ -622,19 +629,14 @@ public void testTableComments()
MaterializedResult resultOfCommentChange = computeActual("SHOW CREATE TABLE test_table_comments");
String afterChangeSql = format(createTableTemplate, "different test table comment", format);
assertEquals(getOnlyElement(resultOfCommentChange.getOnlyColumnAsSet()), afterChangeSql);
dropTable("iceberg.tpch.test_table_comments");

String createTableWithoutComment = "" +
"CREATE TABLE iceberg.tpch.test_table_comments (\n" +
" _x bigint\n" +
")\n" +
"WITH (\n" +
" format = '%s'\n" +
")";
assertUpdate(format(createTableWithoutComment, format));
assertUpdate("COMMENT ON TABLE test_table_comments IS NULL");
MaterializedResult resultOfRemovingComment = computeActual("SHOW CREATE TABLE test_table_comments");
assertEquals(getOnlyElement(resultOfRemovingComment.getOnlyColumnAsSet()), format(createTableWithoutComment, format));
dropTable("iceberg.tpch.test_table_comments");

assertUpdate(format(createTableWithoutComment, format));
assertEquals(computeScalar("SHOW CREATE TABLE test_table_comments"), format(createTableWithoutComment, format));

dropTable("iceberg.tpch.test_table_comments");
}
Expand Down

0 comments on commit 955b7c1

Please sign in to comment.