Skip to content

Commit

Permalink
Add array data type test in Bigquery connector
Browse files Browse the repository at this point in the history
  • Loading branch information
mayankvadariya authored and ebyhr committed Oct 30, 2024
1 parent 3d51e5a commit aa8a470
Showing 1 changed file with 13 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;

/**
Expand Down Expand Up @@ -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<DOUBLE>, c ARRAY<BIGINT>)")) {
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()
{
Expand Down

0 comments on commit aa8a470

Please sign in to comment.