Repository navigation
Conversation
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.
Which issue does this PR close?
No standalone issue. Downstream integration reference: Embucket/rustice#1190.
Rationale for this change
A SQL client cannot currently reconcile domain-specific field metadata in VALUES. Mixing a string literal with a width-annotated typed NULL fails during planning, before functions such as NEXT_DAY can run. Clients need an opt-in policy that preserves the declared metadata.
What changes are included in this PR?
Add a default-declining TypePlanner hook and a logical-builder resolver, called once per conflicting column with borrowed input rows. Default strict errors, equal-metadata fast paths, target-schema VALUES, CASE, type coercion and nullability remain unchanged. No product-specific width policy is embedded in DataFusion.
Are these changes tested?
Builder tests cover complete-column borrowing, one call per conflicting column, equal-metadata bypass, declined resolution and errors, plus SQL-to-TypePlanner integration.
Validated locally on Rust 1.97.0: formatting, Prettier, strict all-target/all-feature Clippy, the unmodified full
dev/rust_lint.sh, and an expr check without default features pass. The extended workspace graph passes across 73 test executables: 10,767 native tests, 10 existing ignored, and all 509 SQL logic files.An IDE OOM interrupted the initial run. Exact fresh Cargo artifacts/source identities were reconciled; the completed 115-test generated-input fuzz executable was retained, and all 72 other executables were rerun after restoring relative fixture paths to the pinned Arrow/Parquet data. No test expectations changed. The final reruns used one test thread under an 8 GiB memory cap.
Are there any user-facing changes?
Additive public APIs: ValuesMetadataResolver, LogicalPlanBuilder::values_with_metadata_resolver and TypePlanner::plan_values_column_metadata. The trait method has a default implementation. Existing callers retain strict behavior unless they opt in.