Skip to content

[#13159] fix(postgresql): Preserve CHAR array element lengths - #13162

Open
laserninja wants to merge 2 commits into
apache:mainfrom
laserninja:fix/postgresql-char-array
Open

laserninja wants to merge 2 commits into
apache:mainfrom
laserninja:fix/postgresql-char-array

Conversation

@laserninja

Copy link
Copy Markdown
Collaborator

What changes were proposed in this pull request?

Pass JDBC column length into the bpchar element conversion for PostgreSQL arrays. Add converter and catalog integration regression tests for CHAR(5)[].

Why are the changes needed?

Loading a table containing CHAR(n)[] currently throws NullPointerException because array conversion discards the length required by FixedCharType.

Fixes #13159

Does this PR introduce any user-facing change?

PostgreSQL CHAR(n)[] columns load as lists of CHAR(n) with nullable elements. No public API or configuration changes.

How was this patch tested?

JAVA_HOME=<JDK17> ./gradlew :catalogs:catalog-jdbc-postgresql:spotlessApply :catalogs:catalog-jdbc-postgresql:build -PskipITs --max-workers=2 passed (47 tests). The new converter test failed before the fix. Against a live PostgreSQL 18 database, catalog table operations returned exactly list<char(5)> and preserved the decimal(10,2) control. The new catalog integration test compiled; the full Docker integration suite was not run.

@github-actions

github-actions Bot commented Sep 15, 2026 •

Copy link
Copy Markdown

Code Coverage Report

Overall Project 72.08% +0.02% 🟢
Files changed 98.9% 🟢

Module Coverage
aliyun 19.74% 🔴
api 55.09% 🟢
authorization-common 85.96% 🟢
authorization-ranger 14.44% 🔴
aws 53.54% 🟢
aws-bundle 0.0% 🔴
azure 32.1% 🔴
azure-bundle 0.0% 🔴
catalog-common 29.49% 🔴
catalog-fileset 82.37% 🟢
catalog-glue 73.24% 🟢
catalog-hive 84.5% 🟢
catalog-jdbc-common 57.98% 🟢
catalog-jdbc-doris 87.56% 🟢
catalog-jdbc-mysql 81.91% 🟢
catalog-jdbc-postgresql 84.07% +2.61% 🟢
catalog-jdbc-starrocks 79.16% 🟢
catalog-kafka 75.21% 🟢
catalog-lakehouse-generic 84.58% 🟢
catalog-lakehouse-hudi 79.1% 🟢
catalog-lakehouse-iceberg 86.8% 🟢
catalog-lakehouse-paimon 84.36% 🟢
catalog-model 77.99% 🟢
cli 44.62% 🟢
client-java 79.44% 🟢
client-java-runtime 0.0% 🔴
common 60.78% 🟢
core 87.5% 🟢
filesystem-hadoop3 76.89% 🟢
flink 55.44% 🟢
flink-common 32.2% 🔴
flink-runtime 0.0% 🔴
gcp 32.2% 🔴
hadoop-auth 68.0% 🟢
hadoop-common 17.84% 🔴
hive-metastore-common 62.3% 🟢
hive-metastore3-libs 58.8% 🟢
iceberg-aliyun-bundle 0.0% 🔴
iceberg-common 66.53% 🟢
iceberg-rest-server 76.94% 🟢
idp-basic 86.77% 🟢
integration-test-common 0.0% 🔴
jobs 71.35% 🟢
k8s-job-executor 97.76% 🟢
lance-common 39.9% 🔴
lance-rest-server 69.51% 🟢
lineage 59.39% 🟢
optimizer 84.27% 🟢
optimizer-api 46.58% 🟢
server 91.43% 🟢
server-common 83.86% 🟢
spark 61.79% 🟢
tencent 81.78% 🟢
tms 80.0% 🟢
trino-connector 64.88% 🟢
Files
Module File Coverage
catalog-jdbc-postgresql PostgreSqlTypeConverter.java 98.9% 🟢

@yuqi1129

Copy link
Copy Markdown
Contributor

Can you take time resolving the comments?

@laserninja

Copy link
Copy Markdown
Collaborator Author

I resolved the conflicts. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug report] PostgreSQL table loading throws NullPointerException for CHAR(n) array columns

2 participants