Skip to content

Commit

Permalink
Use computeScalar for brevity
Browse files Browse the repository at this point in the history
This includes some other minor simplifications.
  • Loading branch information
findepi committed Oct 22, 2021
1 parent 955b7c1 commit 3cfb188
Showing 1 changed file with 7 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -618,25 +618,21 @@ public void testTableComments()
" _x bigint\n" +
")\n" +
"WITH (\n" +
" format = '%s'\n" +
" format = '" + format + "'\n" +
")";
@Language("SQL") String createTableSql = format(createTableTemplate, "test table comment", format);
String createTableSql = format(createTableTemplate, "test table comment", format);
assertUpdate(createTableSql);
MaterializedResult resultOfCreate = computeActual("SHOW CREATE TABLE test_table_comments");
assertEquals(getOnlyElement(resultOfCreate.getOnlyColumnAsSet()), createTableSql);
assertEquals(computeScalar("SHOW CREATE TABLE test_table_comments"), createTableSql);

assertUpdate("COMMENT ON TABLE test_table_comments IS 'different test table comment'");
MaterializedResult resultOfCommentChange = computeActual("SHOW CREATE TABLE test_table_comments");
String afterChangeSql = format(createTableTemplate, "different test table comment", format);
assertEquals(getOnlyElement(resultOfCommentChange.getOnlyColumnAsSet()), afterChangeSql);
assertEquals(computeScalar("SHOW CREATE TABLE test_table_comments"), format(createTableTemplate, "different test table comment", 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));
assertEquals(computeScalar("SHOW CREATE TABLE test_table_comments"), createTableWithoutComment);
dropTable("iceberg.tpch.test_table_comments");

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

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

0 comments on commit 3cfb188

Please sign in to comment.