Skip to content

[SPARK-57809][SQL] Support nanosecond-precision timestamps in collect_list/listagg ordering safety#56946

Open
iRakson wants to merge 1 commit into
apache:masterfrom
iRakson:SPARK-57809
Open

[SPARK-57809][SQL] Support nanosecond-precision timestamps in collect_list/listagg ordering safety#56946
iRakson wants to merge 1 commit into
apache:masterfrom
iRakson:SPARK-57809

Conversation

@iRakson

@iRakson iRakson commented Jul 1, 2026

Copy link
Copy Markdown
Contributor

What changes were proposed in this pull request?

Add nanosecond arms so the ORDER BY-cast optimization applies to NTZ nanos and correctly excludes LTZ nanos, matching the microsecond behavior.

Why are the changes needed?

collect.scala isCastEqualityPreserving (~L750-762) marks TimestampNTZType as cast-equality-preserving and TimestampType (LTZ, DST) as unsafe, but has no arm for TimestampNTZNanosType / TimestampLTZNanosType, so both fall to case _ => false. NTZ nanos should be treated like NTZ micro (safe); LTZ nanos like LTZ micro.

Does this PR introduce any user-facing change?

Yes, nanosecond precision timestamps behaviour would be same as microsecond timestamp behaviour now.

How was this patch tested?

Added UT.

Was this patch authored or co-authored using generative AI tooling?

Claude for writing UT.

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.

1 participant