This is an automated email from the ASF dual-hosted git repository.
yuqi4733 pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/gravitino.git
The following commit(s) were added to refs/heads/main by this push:
new b0a418438e [#5656] fix (trino-connector): Fix failed to create table
including ARRAY data type in Trino (#8209)
b0a418438e is described below
commit b0a418438e282d12cf31f0f7e886240d7396d5f1
Author: Yuhui <[email protected]>
AuthorDate: Mon Aug 25 20:52:29 2025 +0800
[#5656] fix (trino-connector): Fix failed to create table including ARRAY
data type in Trino (#8209)
### What changes were proposed in this pull request?
Fix failed to create table including ARRAY data type in Trino
### Why are the changes needed?
Fix: #5656
### Does this PR introduce _any_ user-facing change?
NO
### How was this patch tested?
Add new It
---
.../trino-ci-testset/testsets/jdbc-postgresql/00006_datatype.sql | 8 ++++++++
.../trino-ci-testset/testsets/jdbc-postgresql/00006_datatype.txt | 8 ++++++++
.../catalog/jdbc/postgresql/PostgreSQLDataTypeTransformer.java | 3 +++
3 files changed, 19 insertions(+)
diff --git
a/trino-connector/integration-test/src/test/resources/trino-ci-testset/testsets/jdbc-postgresql/00006_datatype.sql
b/trino-connector/integration-test/src/test/resources/trino-ci-testset/testsets/jdbc-postgresql/00006_datatype.sql
index 5d08cda40f..57fd701349 100644
---
a/trino-connector/integration-test/src/test/resources/trino-ci-testset/testsets/jdbc-postgresql/00006_datatype.sql
+++
b/trino-connector/integration-test/src/test/resources/trino-ci-testset/testsets/jdbc-postgresql/00006_datatype.sql
@@ -71,8 +71,16 @@ INSERT INTO tb02 (f1, f2, f3, f4, f5, f6, f7, f9, f10, f11,
f12, f13, f14, f15,
VALUES ('Sample text 1', 'same9', x'65', 123.456, 7.89, 12.34, false, 100,
1000, 1000, 1992382342, DATE '2024-01-01',
NULL, TIMESTAMP '2024-01-01 08:00:00', TIMESTAMP '2024-01-01 08:00:00
UTC');
+CREATE TABLE tb03 (int_array ARRAY(INTEGER));
+
+INSERT INTO tb03 VALUES (ARRAY[1, 2, 3, 4, 5]);
+
+SELECT * FROM tb03;
+
drop table tb01;
drop table tb02;
+drop table tb03;
+
drop schema gt_postgresql.gt_db1 cascade;
diff --git
a/trino-connector/integration-test/src/test/resources/trino-ci-testset/testsets/jdbc-postgresql/00006_datatype.txt
b/trino-connector/integration-test/src/test/resources/trino-ci-testset/testsets/jdbc-postgresql/00006_datatype.txt
index ae17e750c3..36c36db470 100644
---
a/trino-connector/integration-test/src/test/resources/trino-ci-testset/testsets/jdbc-postgresql/00006_datatype.txt
+++
b/trino-connector/integration-test/src/test/resources/trino-ci-testset/testsets/jdbc-postgresql/00006_datatype.txt
@@ -61,6 +61,14 @@ INSERT: 1 row
<QUERY_FAILED> NULL value not allowed for NOT NULL column: f14
+CREATE TABLE
+
+INSERT: 1 row
+
+"[1, 2, 3, 4, 5]"
+
+DROP TABLE
+
DROP TABLE
DROP TABLE
diff --git
a/trino-connector/trino-connector/src/main/java/org/apache/gravitino/trino/connector/catalog/jdbc/postgresql/PostgreSQLDataTypeTransformer.java
b/trino-connector/trino-connector/src/main/java/org/apache/gravitino/trino/connector/catalog/jdbc/postgresql/PostgreSQLDataTypeTransformer.java
index 3743595ea9..0134fbacc8 100644
---
a/trino-connector/trino-connector/src/main/java/org/apache/gravitino/trino/connector/catalog/jdbc/postgresql/PostgreSQLDataTypeTransformer.java
+++
b/trino-connector/trino-connector/src/main/java/org/apache/gravitino/trino/connector/catalog/jdbc/postgresql/PostgreSQLDataTypeTransformer.java
@@ -83,6 +83,9 @@ public class PostgreSQLDataTypeTransformer extends
GeneralDataTypeTransformer {
}
return Types.VarCharType.of(varcharType.getLength().get());
+ } else if (typeClass == io.trino.spi.type.ArrayType.class) {
+ return Types.ListType.of(
+ getGravitinoType(((io.trino.spi.type.ArrayType)
type).getElementType()), false);
}
return super.getGravitinoType(type);