From 2d9728a8b7575e5bdb337064c100f5ded0ec0886 Mon Sep 17 00:00:00 2001 From: Kavyabala <54107817+kavyabala23@users.noreply.github.com> Date: Tue, 29 Oct 2024 10:22:33 +0530 Subject: [PATCH 01/12] Added test for rename and set properties TestFakerQueries.java --- .../trino/plugin/faker/TestFakerQueries.java | 24 +++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/plugin/trino-faker/src/test/java/io/trino/plugin/faker/TestFakerQueries.java b/plugin/trino-faker/src/test/java/io/trino/plugin/faker/TestFakerQueries.java index 3b1a7ea235956..6bd0bb4d85bb4 100644 --- a/plugin/trino-faker/src/test/java/io/trino/plugin/faker/TestFakerQueries.java +++ b/plugin/trino-faker/src/test/java/io/trino/plugin/faker/TestFakerQueries.java @@ -35,6 +35,30 @@ void testShowTables() assertUpdate("CREATE TABLE faker.default.test (id INTEGER, name VARCHAR)"); assertTableColumnNames("faker.default.test", "id", "name"); } + @Test + void testRenameTable() + { + assertQuery("SHOW TABLES FROM faker.default LIKE 'original_table'", "SELECT '' WHERE false"); + assertUpdate("CREATE TABLE faker.default.original_table (id INTEGER, name VARCHAR)"); + assertQuery("SHOW TABLES FROM faker.default", "VALUES 'original_table'"); + assertUpdate("ALTER TABLE faker.default.original_table RENAME TO renamed_table"); + assertQuery("SHOW TABLES FROM faker.default LIKE 'renamed_table'", "VALUES 'renamed_table'"); + assertQuery("SHOW TABLES FROM faker.default LIKE 'original_table'", "SELECT '' WHERE false"); + assertUpdate("DROP TABLE faker.default.renamed_table"); + } + @Test + void testAlterTableSetProperties() + { + assertQuery("SHOW TABLES FROM faker.default LIKE 'test_table'", "SELECT '' WHERE false"); + assertUpdate("CREATE TABLE faker.default.test_table (id INTEGER, name VARCHAR)"); + assertQuery("SHOW TABLES FROM faker.default", "VALUES 'test_table'"); + assertUpdate("ALTER TABLE faker.default.test_table SET PROPERTIES comment = 'This is a test table'"); + assertQuery( + "SHOW CREATE TABLE faker.default.test_table", + "VALUES 'CREATE TABLE faker.default.test_table (id INTEGER, name VARCHAR) WITH (comment = ''This is a test table'')'" + ); + assertUpdate("DROP TABLE faker.default.test_table"); + } @Test void testSelectFromTable() From ee90b2a90c3d87f097771f8ffd62a670f83a5697 Mon Sep 17 00:00:00 2001 From: Kavyabala <54107817+kavyabala23@users.noreply.github.com> Date: Tue, 29 Oct 2024 11:14:44 +0530 Subject: [PATCH 02/12] Update set properties to default_limit TestFakerQueries.java --- .../java/io/trino/plugin/faker/TestFakerQueries.java | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/plugin/trino-faker/src/test/java/io/trino/plugin/faker/TestFakerQueries.java b/plugin/trino-faker/src/test/java/io/trino/plugin/faker/TestFakerQueries.java index 6bd0bb4d85bb4..69ccbf1214e41 100644 --- a/plugin/trino-faker/src/test/java/io/trino/plugin/faker/TestFakerQueries.java +++ b/plugin/trino-faker/src/test/java/io/trino/plugin/faker/TestFakerQueries.java @@ -51,15 +51,15 @@ void testAlterTableSetProperties() { assertQuery("SHOW TABLES FROM faker.default LIKE 'test_table'", "SELECT '' WHERE false"); assertUpdate("CREATE TABLE faker.default.test_table (id INTEGER, name VARCHAR)"); - assertQuery("SHOW TABLES FROM faker.default", "VALUES 'test_table'"); - assertUpdate("ALTER TABLE faker.default.test_table SET PROPERTIES comment = 'This is a test table'"); + assertUpdate("ALTER TABLE faker.default.test_table SET PROPERTIES default_limit = 100"); assertQuery( - "SHOW CREATE TABLE faker.default.test_table", - "VALUES 'CREATE TABLE faker.default.test_table (id INTEGER, name VARCHAR) WITH (comment = ''This is a test table'')'" + "SELECT table_property_name, table_property_value FROM information_schema.tables WHERE table_name = 'test_table' AND table_property_name = 'default_limit'", + "VALUES ('default_limit', '100')" ); - assertUpdate("DROP TABLE faker.default.test_table"); + assertUpdate("DROP TABLE faker.default.test_table"); } + @Test void testSelectFromTable() { From 1da9315a2b5903e9e3a5800216af934041f2c33c Mon Sep 17 00:00:00 2001 From: Kavyabala <54107817+kavyabala23@users.noreply.github.com> Date: Tue, 29 Oct 2024 11:38:57 +0530 Subject: [PATCH 03/12] updated as per codestyle TestFakerQueries.java --- .../trino/plugin/faker/TestFakerQueries.java | 27 +++++++++---------- 1 file changed, 13 insertions(+), 14 deletions(-) diff --git a/plugin/trino-faker/src/test/java/io/trino/plugin/faker/TestFakerQueries.java b/plugin/trino-faker/src/test/java/io/trino/plugin/faker/TestFakerQueries.java index 69ccbf1214e41..b31a2418e0908 100644 --- a/plugin/trino-faker/src/test/java/io/trino/plugin/faker/TestFakerQueries.java +++ b/plugin/trino-faker/src/test/java/io/trino/plugin/faker/TestFakerQueries.java @@ -35,31 +35,30 @@ void testShowTables() assertUpdate("CREATE TABLE faker.default.test (id INTEGER, name VARCHAR)"); assertTableColumnNames("faker.default.test", "id", "name"); } + @Test void testRenameTable() { - assertQuery("SHOW TABLES FROM faker.default LIKE 'original_table'", "SELECT '' WHERE false"); - assertUpdate("CREATE TABLE faker.default.original_table (id INTEGER, name VARCHAR)"); - assertQuery("SHOW TABLES FROM faker.default", "VALUES 'original_table'"); - assertUpdate("ALTER TABLE faker.default.original_table RENAME TO renamed_table"); - assertQuery("SHOW TABLES FROM faker.default LIKE 'renamed_table'", "VALUES 'renamed_table'"); - assertQuery("SHOW TABLES FROM faker.default LIKE 'original_table'", "SELECT '' WHERE false"); - assertUpdate("DROP TABLE faker.default.renamed_table"); + assertQuery("SHOW TABLES FROM faker.default LIKE 'original_table'", "SELECT '' WHERE false"); + assertUpdate("CREATE TABLE faker.default.original_table (id INTEGER, name VARCHAR)"); + assertQuery("SHOW TABLES FROM faker.default", "VALUES 'original_table'"); + assertUpdate("ALTER TABLE faker.default.original_table RENAME TO renamed_table"); + assertQuery("SHOW TABLES FROM faker.default LIKE 'renamed_table'", "VALUES 'renamed_table'"); + assertQuery("SHOW TABLES FROM faker.default LIKE 'original_table'", "SELECT '' WHERE false"); + assertUpdate("DROP TABLE faker.default.renamed_table"); } + @Test void testAlterTableSetProperties() { assertQuery("SHOW TABLES FROM faker.default LIKE 'test_table'", "SELECT '' WHERE false"); assertUpdate("CREATE TABLE faker.default.test_table (id INTEGER, name VARCHAR)"); assertUpdate("ALTER TABLE faker.default.test_table SET PROPERTIES default_limit = 100"); - assertQuery( - "SELECT table_property_name, table_property_value FROM information_schema.tables WHERE table_name = 'test_table' AND table_property_name = 'default_limit'", - "VALUES ('default_limit', '100')" - ); - assertUpdate("DROP TABLE faker.default.test_table"); + assertQuery("SELECT table_property_name, table_property_value FROM information_schema.tables WHERE table_name = 'test_table' AND table_property_name = 'default_limit'", + "VALUES ('default_limit', '100')"); + assertUpdate("DROP TABLE faker.default.test_table"); } - @Test void testSelectFromTable() { @@ -218,7 +217,7 @@ void testSelectLimit() assertQuery(testQuery, "VALUES (1000)"); assertUpdate("DROP TABLE faker.default.single_column"); } - + @Test void testSelectDefaultTableLimit() { From c83b75dedb773b747ec38849d95322293eac3fb2 Mon Sep 17 00:00:00 2001 From: Kavyabala <54107817+kavyabala23@users.noreply.github.com> Date: Tue, 29 Oct 2024 14:32:05 +0530 Subject: [PATCH 04/12] Updated TestFakerQueries.java --- .../src/test/java/io/trino/plugin/faker/TestFakerQueries.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/plugin/trino-faker/src/test/java/io/trino/plugin/faker/TestFakerQueries.java b/plugin/trino-faker/src/test/java/io/trino/plugin/faker/TestFakerQueries.java index b31a2418e0908..a17406ce59e81 100644 --- a/plugin/trino-faker/src/test/java/io/trino/plugin/faker/TestFakerQueries.java +++ b/plugin/trino-faker/src/test/java/io/trino/plugin/faker/TestFakerQueries.java @@ -54,8 +54,7 @@ void testAlterTableSetProperties() assertQuery("SHOW TABLES FROM faker.default LIKE 'test_table'", "SELECT '' WHERE false"); assertUpdate("CREATE TABLE faker.default.test_table (id INTEGER, name VARCHAR)"); assertUpdate("ALTER TABLE faker.default.test_table SET PROPERTIES default_limit = 100"); - assertQuery("SELECT table_property_name, table_property_value FROM information_schema.tables WHERE table_name = 'test_table' AND table_property_name = 'default_limit'", - "VALUES ('default_limit', '100')"); + assertQuery("SELECT table_property_name, table_property_value FROM information_schema.tables WHERE table_name = 'test_table' AND table_property_name = 'default_limit'","VALUES ('default_limit', '100')"); assertUpdate("DROP TABLE faker.default.test_table"); } From e7dd1176464ca21bdf21f49a80fb220dbd3f239a Mon Sep 17 00:00:00 2001 From: Kavyabala <54107817+kavyabala23@users.noreply.github.com> Date: Wed, 30 Oct 2024 11:39:11 +0530 Subject: [PATCH 05/12] Update TestFakerQueries.java --- .../io/trino/plugin/faker/TestFakerQueries.java | 15 +-------------- 1 file changed, 1 insertion(+), 14 deletions(-) diff --git a/plugin/trino-faker/src/test/java/io/trino/plugin/faker/TestFakerQueries.java b/plugin/trino-faker/src/test/java/io/trino/plugin/faker/TestFakerQueries.java index a17406ce59e81..6f4fab56813d7 100644 --- a/plugin/trino-faker/src/test/java/io/trino/plugin/faker/TestFakerQueries.java +++ b/plugin/trino-faker/src/test/java/io/trino/plugin/faker/TestFakerQueries.java @@ -39,24 +39,11 @@ void testShowTables() @Test void testRenameTable() { - assertQuery("SHOW TABLES FROM faker.default LIKE 'original_table'", "SELECT '' WHERE false"); assertUpdate("CREATE TABLE faker.default.original_table (id INTEGER, name VARCHAR)"); - assertQuery("SHOW TABLES FROM faker.default", "VALUES 'original_table'"); assertUpdate("ALTER TABLE faker.default.original_table RENAME TO renamed_table"); - assertQuery("SHOW TABLES FROM faker.default LIKE 'renamed_table'", "VALUES 'renamed_table'"); - assertQuery("SHOW TABLES FROM faker.default LIKE 'original_table'", "SELECT '' WHERE false"); + assertQuery("SELECT table_name FROM information_schema.tables WHERE table_catalog = 'faker' AND table_schema = 'default' AND table_name = 'renamed_table'", "VALUES 'renamed_table'"); assertUpdate("DROP TABLE faker.default.renamed_table"); } - - @Test - void testAlterTableSetProperties() - { - assertQuery("SHOW TABLES FROM faker.default LIKE 'test_table'", "SELECT '' WHERE false"); - assertUpdate("CREATE TABLE faker.default.test_table (id INTEGER, name VARCHAR)"); - assertUpdate("ALTER TABLE faker.default.test_table SET PROPERTIES default_limit = 100"); - assertQuery("SELECT table_property_name, table_property_value FROM information_schema.tables WHERE table_name = 'test_table' AND table_property_name = 'default_limit'","VALUES ('default_limit', '100')"); - assertUpdate("DROP TABLE faker.default.test_table"); - } @Test void testSelectFromTable() From 7f79ac2e376ee1341f7bda13f04a60fcdb223439 Mon Sep 17 00:00:00 2001 From: Kavyabala <54107817+kavyabala23@users.noreply.github.com> Date: Wed, 30 Oct 2024 16:55:11 +0530 Subject: [PATCH 06/12] renametable TestFakerQueries.java --- .../test/java/io/trino/plugin/faker/TestFakerQueries.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/plugin/trino-faker/src/test/java/io/trino/plugin/faker/TestFakerQueries.java b/plugin/trino-faker/src/test/java/io/trino/plugin/faker/TestFakerQueries.java index 6f4fab56813d7..5aa6450cb0949 100644 --- a/plugin/trino-faker/src/test/java/io/trino/plugin/faker/TestFakerQueries.java +++ b/plugin/trino-faker/src/test/java/io/trino/plugin/faker/TestFakerQueries.java @@ -35,16 +35,19 @@ void testShowTables() assertUpdate("CREATE TABLE faker.default.test (id INTEGER, name VARCHAR)"); assertTableColumnNames("faker.default.test", "id", "name"); } - + @Test void testRenameTable() { assertUpdate("CREATE TABLE faker.default.original_table (id INTEGER, name VARCHAR)"); assertUpdate("ALTER TABLE faker.default.original_table RENAME TO renamed_table"); - assertQuery("SELECT table_name FROM information_schema.tables WHERE table_catalog = 'faker' AND table_schema = 'default' AND table_name = 'renamed_table'", "VALUES 'renamed_table'"); + @Language("SQL") + String testQuery = "SELECT table_name FROM information_schema.tables " + "WHERE table_catalog = 'faker' AND table_schema = 'default' " + "AND table_name = 'renamed_table'"; + assertQuery(testQuery, "VALUES 'renamed_table'"); assertUpdate("DROP TABLE faker.default.renamed_table"); } + @Test void testSelectFromTable() { From ddf77a5f9ac4780f8aa8f41b8481a463c8ee75fc Mon Sep 17 00:00:00 2001 From: Kavyabala <54107817+kavyabala23@users.noreply.github.com> Date: Wed, 30 Oct 2024 17:37:37 +0530 Subject: [PATCH 07/12] renametable TestFakerQueries.java --- .../src/test/java/io/trino/plugin/faker/TestFakerQueries.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugin/trino-faker/src/test/java/io/trino/plugin/faker/TestFakerQueries.java b/plugin/trino-faker/src/test/java/io/trino/plugin/faker/TestFakerQueries.java index 5aa6450cb0949..c5c6cfbb08773 100644 --- a/plugin/trino-faker/src/test/java/io/trino/plugin/faker/TestFakerQueries.java +++ b/plugin/trino-faker/src/test/java/io/trino/plugin/faker/TestFakerQueries.java @@ -42,7 +42,7 @@ void testRenameTable() assertUpdate("CREATE TABLE faker.default.original_table (id INTEGER, name VARCHAR)"); assertUpdate("ALTER TABLE faker.default.original_table RENAME TO renamed_table"); @Language("SQL") - String testQuery = "SELECT table_name FROM information_schema.tables " + "WHERE table_catalog = 'faker' AND table_schema = 'default' " + "AND table_name = 'renamed_table'"; + String testQuery = "SELECT table_name FROM information_schema.tables WHERE table_schema = 'faker' AND table_name = 'renamed_table'"; assertQuery(testQuery, "VALUES 'renamed_table'"); assertUpdate("DROP TABLE faker.default.renamed_table"); } From a83fca49d627b92e1ace88d98b10a7303a6bea9b Mon Sep 17 00:00:00 2001 From: Kavyabala <54107817+kavyabala23@users.noreply.github.com> Date: Thu, 31 Oct 2024 13:05:56 +0530 Subject: [PATCH 08/12] RenameTable TestFakerQueries.java --- .../java/io/trino/plugin/faker/TestFakerQueries.java | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/plugin/trino-faker/src/test/java/io/trino/plugin/faker/TestFakerQueries.java b/plugin/trino-faker/src/test/java/io/trino/plugin/faker/TestFakerQueries.java index c5c6cfbb08773..cc95ae4b73fc7 100644 --- a/plugin/trino-faker/src/test/java/io/trino/plugin/faker/TestFakerQueries.java +++ b/plugin/trino-faker/src/test/java/io/trino/plugin/faker/TestFakerQueries.java @@ -34,20 +34,18 @@ void testShowTables() assertQuery("SHOW SCHEMAS FROM faker", "VALUES 'default', 'information_schema'"); assertUpdate("CREATE TABLE faker.default.test (id INTEGER, name VARCHAR)"); assertTableColumnNames("faker.default.test", "id", "name"); + assertUpdate("DROP TABLE faker.default.test"); } @Test void testRenameTable() { assertUpdate("CREATE TABLE faker.default.original_table (id INTEGER, name VARCHAR)"); + assertQuery("SHOW TABLES FROM faker.default", "VALUES 'original_table'"); assertUpdate("ALTER TABLE faker.default.original_table RENAME TO renamed_table"); - @Language("SQL") - String testQuery = "SELECT table_name FROM information_schema.tables WHERE table_schema = 'faker' AND table_name = 'renamed_table'"; - assertQuery(testQuery, "VALUES 'renamed_table'"); - assertUpdate("DROP TABLE faker.default.renamed_table"); + assertQuery("SHOW TABLES FROM faker.default", "VALUES 'renamed_table'"); } - @Test void testSelectFromTable() { @@ -206,7 +204,7 @@ void testSelectLimit() assertQuery(testQuery, "VALUES (1000)"); assertUpdate("DROP TABLE faker.default.single_column"); } - + @Test void testSelectDefaultTableLimit() { From 8224d8fc2ee92907521fdbb0fbe034ce819df2bf Mon Sep 17 00:00:00 2001 From: Kavyabala <54107817+kavyabala23@users.noreply.github.com> Date: Thu, 31 Oct 2024 13:37:47 +0530 Subject: [PATCH 09/12] RenameTableTestFakerQueries.java --- .../io/trino/plugin/faker/TestFakerQueries.java | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/plugin/trino-faker/src/test/java/io/trino/plugin/faker/TestFakerQueries.java b/plugin/trino-faker/src/test/java/io/trino/plugin/faker/TestFakerQueries.java index f5e20e4399155..2bf3ed7fadf83 100644 --- a/plugin/trino-faker/src/test/java/io/trino/plugin/faker/TestFakerQueries.java +++ b/plugin/trino-faker/src/test/java/io/trino/plugin/faker/TestFakerQueries.java @@ -34,16 +34,15 @@ void testShowTables() assertQuery("SHOW SCHEMAS FROM faker", "VALUES 'default', 'information_schema'"); assertUpdate("CREATE TABLE faker.default.test (id INTEGER, name VARCHAR)"); assertTableColumnNames("faker.default.test", "id", "name"); - assertUpdate("DROP TABLE faker.default.test"); } @Test void testRenameTable() { assertUpdate("CREATE TABLE faker.default.original_table (id INTEGER, name VARCHAR)"); - assertQuery("SHOW TABLES FROM faker.default", "VALUES 'original_table'"); + assertQuery("SHOW TABLES FROM faker.default LIKE 'original_table'", "VALUES 'original_table'"); assertUpdate("ALTER TABLE faker.default.original_table RENAME TO renamed_table"); - assertQuery("SHOW TABLES FROM faker.default", "VALUES 'renamed_table'"); + assertQuery("SHOW TABLES FROM faker.default LIKE 'renamed_table'", "VALUES 'renamed_table'"); } @Test @@ -255,6 +254,14 @@ void testSelectGenerator() assertUpdate("DROP TABLE faker.default.generators"); } + @Test + void testSelectFunctions() + { + @Language("SQL") + String testQuery = "SELECT random_string('#{options.option ''a'', ''b''}') IN ('a', 'b')"; + assertQuery(testQuery, "VALUES (true)"); + } + @Test void testSelectRange() { From 1975c6e7231e46f60da27770246d8edc5ad90ec4 Mon Sep 17 00:00:00 2001 From: Kavyabala <54107817+kavyabala23@users.noreply.github.com> Date: Thu, 31 Oct 2024 13:59:46 +0530 Subject: [PATCH 10/12] RenameTable TestFakerQueries.java --- .../java/io/trino/plugin/faker/TestFakerQueries.java | 9 --------- 1 file changed, 9 deletions(-) diff --git a/plugin/trino-faker/src/test/java/io/trino/plugin/faker/TestFakerQueries.java b/plugin/trino-faker/src/test/java/io/trino/plugin/faker/TestFakerQueries.java index 2bf3ed7fadf83..c83db4db979bb 100644 --- a/plugin/trino-faker/src/test/java/io/trino/plugin/faker/TestFakerQueries.java +++ b/plugin/trino-faker/src/test/java/io/trino/plugin/faker/TestFakerQueries.java @@ -35,7 +35,6 @@ void testShowTables() assertUpdate("CREATE TABLE faker.default.test (id INTEGER, name VARCHAR)"); assertTableColumnNames("faker.default.test", "id", "name"); } - @Test void testRenameTable() { @@ -254,14 +253,6 @@ void testSelectGenerator() assertUpdate("DROP TABLE faker.default.generators"); } - @Test - void testSelectFunctions() - { - @Language("SQL") - String testQuery = "SELECT random_string('#{options.option ''a'', ''b''}') IN ('a', 'b')"; - assertQuery(testQuery, "VALUES (true)"); - } - @Test void testSelectRange() { From bbf09f8b38820eb6daac087669fbfae48a48d5c3 Mon Sep 17 00:00:00 2001 From: Kavyabala <54107817+kavyabala23@users.noreply.github.com> Date: Thu, 31 Oct 2024 15:28:22 +0530 Subject: [PATCH 11/12] RenameTable TestFakerQueries.java --- .../src/test/java/io/trino/plugin/faker/TestFakerQueries.java | 1 + 1 file changed, 1 insertion(+) diff --git a/plugin/trino-faker/src/test/java/io/trino/plugin/faker/TestFakerQueries.java b/plugin/trino-faker/src/test/java/io/trino/plugin/faker/TestFakerQueries.java index c83db4db979bb..3202e5d4dd1cd 100644 --- a/plugin/trino-faker/src/test/java/io/trino/plugin/faker/TestFakerQueries.java +++ b/plugin/trino-faker/src/test/java/io/trino/plugin/faker/TestFakerQueries.java @@ -35,6 +35,7 @@ void testShowTables() assertUpdate("CREATE TABLE faker.default.test (id INTEGER, name VARCHAR)"); assertTableColumnNames("faker.default.test", "id", "name"); } + @Test void testRenameTable() { From bcf01c3d2999fd7445fc1637f8234cbc83aff250 Mon Sep 17 00:00:00 2001 From: Kavyabala <54107817+kavyabala23@users.noreply.github.com> Date: Mon, 4 Nov 2024 12:38:28 +0530 Subject: [PATCH 12/12] Rename and Comment on table is done TestFakerQueries.java --- .../io/trino/plugin/faker/TestFakerQueries.java | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/plugin/trino-faker/src/test/java/io/trino/plugin/faker/TestFakerQueries.java b/plugin/trino-faker/src/test/java/io/trino/plugin/faker/TestFakerQueries.java index c8ee8a990d8bc..6310c5e96b839 100644 --- a/plugin/trino-faker/src/test/java/io/trino/plugin/faker/TestFakerQueries.java +++ b/plugin/trino-faker/src/test/java/io/trino/plugin/faker/TestFakerQueries.java @@ -18,6 +18,8 @@ import org.intellij.lang.annotations.Language; import org.junit.jupiter.api.Test; +import static org.assertj.core.api.Assertions.assertThat; + final class TestFakerQueries extends AbstractTestQueryFramework { @@ -35,7 +37,7 @@ void testShowTables() assertUpdate("CREATE TABLE faker.default.test (id INTEGER, name VARCHAR)"); assertTableColumnNames("faker.default.test", "id", "name"); } - + @Test void testRenameTable() { @@ -45,6 +47,15 @@ void testRenameTable() assertQuery("SHOW TABLES FROM faker.default LIKE 'renamed_table'", "VALUES 'renamed_table'"); } + @Test + void tableComment() + { + assertUpdate("CREATE TABLE faker.default.table_comment (id INTEGER, name VARCHAR)"); + assertUpdate("COMMENT ON TABLE faker.default.table_comment IS 'test table comment'"); + assertQuery("SELECT comment FROM system.metadata.table_comments WHERE catalog_name = 'faker' AND schema_name = 'default' AND table_name = 'table_comment'" , "VALUES('test table comment')"); + assertUpdate("DROP TABLE faker.default.table_comment"); + } + @Test void testSelectFromTable() {