[SPARK-57810][SQL] Infer nanosecond-precision timestamp types in XML schema inference#56935
Open
yadavay-amzn wants to merge 2 commits into
Open
[SPARK-57810][SQL] Infer nanosecond-precision timestamp types in XML schema inference#56935yadavay-amzn wants to merge 2 commits into
yadavay-amzn wants to merge 2 commits into
Conversation
…clarify nanos comment
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.
What changes were proposed in this pull request?
Extends XML schema inference (
XmlInferSchema) to infer nanosecond-precision timestamp types. A timestamp string with more than 6 fractional-second digits (with timezone info) now infers as the nanosecond LTZ timestamp type, mirroring the existing nanosecond NTZ inference in the same file and the JSON/CSV nanosecond-inference approach. Behavior is gated on the existing nanosecond-timestamp config; values with <= 6 fractional digits still infer as the microsecondTimestampType.Why are the changes needed?
Part of nanosecond-precision timestamp support (SPARK-56822). XML inference previously truncated sub-microsecond timestamps to microsecond precision; it should infer the nanosecond type when the data warrants it, consistent with JSON and CSV.
Does this PR introduce any user-facing change?
Yes - with nanosecond timestamp types enabled, XML schema inference can infer a nanosecond-precision timestamp type for sub-microsecond timestamps (previously inferred as microsecond
TimestampType).How was this patch tested?
XmlInferSchemaSuite: new tests covering pure-nanosecond inference, pure-microsecond (unchanged), mixed widening, and string fallback.Was this patch authored or co-authored using generative AI tooling?
Authored with assistance by Claude Opus 4.8.