You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@gravitino.apache.org by js...@apache.org on 2025/08/26 03:41:53 UTC
(gravitino) branch branch-0.9 updated: [#5656] fix (trino-connector): Fix failed to create table including ARRAY data type in Trino (#8272)
This is an automated email from the ASF dual-hosted git repository.
jshao pushed a commit to branch branch-0.9
in repository https://gitbox.apache.org/repos/asf/gravitino.git
The following commit(s) were added to refs/heads/branch-0.9 by this push:
new 7a32c37ec3 [#5656] fix (trino-connector): Fix failed to create table including ARRAY data type in Trino (#8272)
7a32c37ec3 is described below
commit 7a32c37ec38dca9f0809e4ba873d6d1dab0e57f0
Author: github-actions[bot] <41...@users.noreply.github.com>
AuthorDate: Tue Aug 26 11:41:50 2025 +0800
[#5656] fix (trino-connector): Fix failed to create table including ARRAY data type in Trino (#8272)
### 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
Co-authored-by: Yuhui <hu...@datastrato.com>
---
.../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);