Repository navigation
branch-4.2: [fix](jdbc) Fix PostgreSQL array dimensions without values - #71026
Merged
yiguolei merged 1 commit intoNov 26, 2026
Merged
Conversation
### Background The release-branch PostgreSQL JDBC client infers array dimensions by sampling a non-NULL table value. The connector implementation on master already uses declared dimensions from PostgreSQL system catalogs, while this branch still uses array_ndims on row data. ### What problem does this PR solve? Issue Number: None Related PR: apache#62183 (contains the metadata lookup in the connector implementation) PR Type: Bugfix Problem Summary: Backport the PostgreSQL array-dimension metadata lookup to the release branch's existing JDBC client. Read pg_attribute.attndims through a prepared query so all-NULL and empty-array columns can be mapped without requiring a non-empty row. Keep the branch's existing metadata filters and type mappings and add the original one-/two-dimensional NULL and empty-array regression fixtures and results. ### Details - **Frequency:** When an array column has only NULL or empty-array values at metadata loading time. - **Root cause:** array_ndims sampling yields no usable dimensions for these values, leaving the array type unsupported. - **Why existing tests missed it:** Existing array cases contained non-empty values; they did not cover entirely NULL or empty one-/two-dimensional columns. - **Fix:** Query attndims by schema, table and column using bound parameters and pass the result through the existing JdbcFieldSchema and nested-array conversion path. - **Other paths and branches:** Scalar metadata and all existing branch-specific filters/type mappings are preserved. The same isolated fix is being backported to maintained 4.0, 4.1 and 4.2 release branches. - **Behavior change:** Array metadata uses the declared dimensions even when table values contain no dimension information. ### Testing - Passed ./build.sh --fe -j4 on this target branch with macOS ARM64, JDK 17 and Maven 3.9.8. FE source/test-source compilation, Checkstyle for modified Java sources and output packaging succeeded; optional UI, JuiceFS, Hive UDF and BE Java-extension builds were disabled locally. - Static checks verified that exactly five intended files changed, that the production edit applies the original metadata lookup while retaining all other branch-specific code, and that the original regression output sections are preserved byte for byte. No golden output was handwritten or regenerated. - Source whitespace checks passed. Original TSV output trailing columns are retained. - PostgreSQL external-docker regression was not run because the local Docker daemon is unavailable. No unit or live regression test execution is claimed. - Local-only build environment adjustment: gated the unrelated native third-party rebuild check on BUILD_BE/BUILD_CLOUD so --fe did not rebuild BE dependencies. Used a local Thrift 0.24 generator matching the branch runtime and regenerated stale local sources. The tracked build.sh was restored before committing; no build-script or generated-code change is included. ### Release note Fix PostgreSQL JDBC type mapping for array columns containing only NULL or empty arrays, including declared two-dimensional arrays. ### Check List (For Author) - Behavior changed: Yes (see Details). - Does this need documentation: No. - Pre-submission status: Partially verified: FE build and static checks passed; PostgreSQL external-docker regression was not run because the local Docker daemon is unavailable. ### AI Disclosure - Tool: Codex (GPT-6). - Generated: Backport adaptation, validation and this description. - Human review: Pending. (cherry picked from commit b0bdfc5cac580f0637e9d6b22dc169b633e89161)
Contributor
|
run compile |
yiguolei
approved these changes
Nov 26, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Background
The release-branch PostgreSQL JDBC client infers array dimensions by sampling a non-NULL table value. The connector implementation on master already uses declared dimensions from PostgreSQL system catalogs, while this branch still uses array_ndims on row data.
What problem does this PR solve?
Issue Number: None
Related PR: #62183 (contains the metadata lookup in the connector implementation)
PR Type: Bugfix
Problem Summary:
Backport the PostgreSQL array-dimension metadata lookup to the release branch's existing JDBC client. Read pg_attribute.attndims through a prepared query so all-NULL and empty-array columns can be mapped without requiring a non-empty row. Keep the branch's existing metadata filters and type mappings and add the original one-/two-dimensional NULL and empty-array regression fixtures and results.
Details
Testing
Release note
Fix PostgreSQL JDBC type mapping for array columns containing only NULL or empty arrays, including declared two-dimensional arrays.
Check List (For Author)
AI Disclosure