Skip to content

Report Object class for dynamic UNION and VARIANT metadata - #907

Merged
staticlibs merged 2 commits into
duckdb:mainfrom
hutiefang76:frank/nextten-dd-dynamic-metadata-20261009-01a11186
Oct 10, 2026
Merged

staticlibs merged 2 commits into
duckdb:mainfrom
hutiefang76:frank/nextten-dd-dynamic-metadata-20261009-01a11186

Conversation

@hutiefang76

Copy link
Copy Markdown
Contributor

UNION and VARIANT columns currently report java.lang.String from getColumnClassName even when getObject returns an Integer or another member type. Consumers that select casts from the metadata can receive a ClassCastException. Return java.lang.Object for these dynamic types so every non-null member is an instance of the reported class. The shared mapping also corrects parameter metadata; SQL type codes remain Types.OTHER.

Regression tests cover mixed integer/string/null rows, metadata before row iteration, compatibility of returned values, unchanged VARCHAR/JSON neighbors, and UNION/VARIANT parameters. Both new column regressions fail against the original class.

Using JDK 17 and the official test runner, TestMetadata passed 34 tests, TestParameterMetadata 7, TestVariant 15, and the array method filter 40. Validation compiled the three changed Java classes and ran them ahead of an existing immutable JNI build on the classpath. No native rebuild or full project suite was run.

AI assistance: DeepSeek assisted implementation and initial review. The complete diff and actual baseline/modified test output were checked before submission.

Signed-off-by: hutiefang76 <137664623+hutiefang76@users.noreply.github.com>

@staticlibs staticlibs left a comment •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR! The change looks good to me, just please adjust the test TestDuckDBJDBC#test_getColumnClassName that started failing after the change.

Signed-off-by: hutiefang76 <137664623+hutiefang76@users.noreply.github.com>
@staticlibs
staticlibs merged commit 501f7b6 into duckdb:main Oct 10, 2026
31 of 32 checks passed
staticlibs added a commit that referenced this pull request Oct 10, 2026
This is a backport of the PR #907 to `v2.0-cyanoptera` branch.

Co-Authored-By: hutiefang76 <137664623+hutiefang76@users.noreply.github.com>
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.

2 participants