From aa8a4702b8e9c15f2a301dd2031f3c82a9f40831 Mon Sep 17 00:00:00 2001 From: Mayank Vadariya <48036907+mayankvadariya@users.noreply.github.com> Date: Wed, 30 Oct 2024 16:20:49 -0400 Subject: [PATCH] Add array data type test in Bigquery connector --- .../plugin/bigquery/BaseBigQueryTypeMapping.java | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/plugin/trino-bigquery/src/test/java/io/trino/plugin/bigquery/BaseBigQueryTypeMapping.java b/plugin/trino-bigquery/src/test/java/io/trino/plugin/bigquery/BaseBigQueryTypeMapping.java index de5d9abc4bb7..9724da1b9b55 100644 --- a/plugin/trino-bigquery/src/test/java/io/trino/plugin/bigquery/BaseBigQueryTypeMapping.java +++ b/plugin/trino-bigquery/src/test/java/io/trino/plugin/bigquery/BaseBigQueryTypeMapping.java @@ -48,6 +48,7 @@ import static io.trino.type.JsonType.JSON; import static java.lang.String.format; import static java.time.ZoneOffset.UTC; +import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThatThrownBy; /** @@ -734,6 +735,18 @@ public void testArray() .execute(getQueryRunner(), bigqueryViewCreateAndInsert("test.array")); } + @Test + public void testArrayType() + { + try (TestTable table = new TestTable(getQueryRunner()::execute, "test_array_", "(a BIGINT, b ARRAY, c ARRAY)")) { + assertUpdate("INSERT INTO " + table.getName() + " (a, b, c) VALUES (5, ARRAY[1.23E1], ARRAY[15]), (6, ARRAY[1.24E1, 1.27E1, 2.23E1], ARRAY[25, 26, 36])", 2); + assertThat(query("SELECT * FROM " + table.getName())) + .matches("VALUES " + + "(BIGINT '5', ARRAY[DOUBLE '12.3'], ARRAY[BIGINT '15']), " + + "(BIGINT '6', ARRAY[DOUBLE '12.4', DOUBLE '12.7', DOUBLE '22.3'], ARRAY[BIGINT '25', BIGINT '26', BIGINT '36'])"); + } + } + @Test public void testUnsupportedNullArray() {