From 129a3ff7de3da53bb8b6732b31f51d416ea802be Mon Sep 17 00:00:00 2001 From: Piotr Findeisen Date: Mon, 16 Nov 2020 15:32:55 +0100 Subject: [PATCH] Simplify QueryExecutor usage in TestIcebergCreateTable --- .../tests/iceberg/TestIcebergCreateTable.java | 23 ++++++++----------- 1 file changed, 9 insertions(+), 14 deletions(-) diff --git a/presto-product-tests/src/main/java/io/prestosql/tests/iceberg/TestIcebergCreateTable.java b/presto-product-tests/src/main/java/io/prestosql/tests/iceberg/TestIcebergCreateTable.java index 13904f9995cc..67fa885bb63d 100644 --- a/presto-product-tests/src/main/java/io/prestosql/tests/iceberg/TestIcebergCreateTable.java +++ b/presto-product-tests/src/main/java/io/prestosql/tests/iceberg/TestIcebergCreateTable.java @@ -16,7 +16,6 @@ import io.prestosql.tempto.AfterTestWithContext; import io.prestosql.tempto.BeforeTestWithContext; import io.prestosql.tempto.ProductTest; -import io.prestosql.tempto.query.QueryExecutor; import io.prestosql.testng.services.Flaky; import org.testng.annotations.Test; @@ -46,41 +45,37 @@ public void cleanUp() @Flaky(issue = "https://github.com/prestosql/presto/issues/4864", match = "Failed to read footer of file") public void testCreateTable() { - String tableName = "test_create_table_" + randomTableSuffix(); - QueryExecutor queryExecutor = onPresto(); - queryExecutor.executeQuery("use iceberg.iceberg"); - queryExecutor.executeQuery("CREATE TABLE " + tableName + "(a bigint, b varchar)"); - queryExecutor.executeQuery("INSERT INTO " + tableName + "(a, b) VALUES " + + String tableName = "iceberg.iceberg.test_create_table_" + randomTableSuffix(); + onPresto().executeQuery("CREATE TABLE " + tableName + "(a bigint, b varchar)"); + onPresto().executeQuery("INSERT INTO " + tableName + "(a, b) VALUES " + "(NULL, NULL), " + "(-42, 'abc'), " + "(9223372036854775807, 'abcdefghijklmnopqrstuvwxyz')"); - assertThat(queryExecutor.executeQuery("SELECT * FROM " + tableName)) + assertThat(onPresto().executeQuery("SELECT * FROM " + tableName)) .containsOnly( row(null, null), row(-42, "abc"), row(9223372036854775807L, "abcdefghijklmnopqrstuvwxyz")); - queryExecutor.executeQuery("DROP TABLE " + tableName); + onPresto().executeQuery("DROP TABLE " + tableName); } @Test(groups = {ICEBERG, STORAGE_FORMATS}) @Flaky(issue = "https://github.com/prestosql/presto/issues/4864", match = "Failed to read footer of file") public void testCreateTableAsSelect() { - String tableName = "test_create_table_as_select_" + randomTableSuffix(); - QueryExecutor queryExecutor = onPresto(); - queryExecutor.executeQuery("use iceberg.iceberg"); - queryExecutor.executeQuery("" + + String tableName = "iceberg.iceberg.test_create_table_as_select_" + randomTableSuffix(); + onPresto().executeQuery("" + "CREATE TABLE " + tableName + " AS " + "SELECT * FROM (VALUES " + " (NULL, NULL), " + " (-42, 'abc'), " + " (9223372036854775807, 'abcdefghijklmnopqrstuvwxyz')" + ") t(a, b)"); - assertThat(queryExecutor.executeQuery("SELECT * FROM " + tableName)) + assertThat(onPresto().executeQuery("SELECT * FROM " + tableName)) .containsOnly( row(null, null), row(-42, "abc"), row(9223372036854775807L, "abcdefghijklmnopqrstuvwxyz")); - queryExecutor.executeQuery("DROP TABLE " + tableName); + onPresto().executeQuery("DROP TABLE " + tableName); } }