suxiaogang223 opened a new pull request, #71025: URL: https://github.com/apache/doris/pull/71025
### 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 - **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 and output packaging succeeded; optional UI and JuiceFS packaging 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. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
