[SPARK-58741][SQL][TESTS] Add nanosecond-timestamp coverage for collect_list - #57964
Open
stevomitric wants to merge 1 commit into
Open
[SPARK-58741][SQL][TESTS] Add nanosecond-timestamp coverage for collect_list#57964stevomitric wants to merge 1 commit into
stevomitric wants to merge 1 commit into
Conversation
…ct_list `collect_list` is a type-agnostic aggregate: its `ArrayBuffer` buffer holds the physical `TimestampNanosVal` and the result element type is exactly `child.dataType`. It already works over the nanosecond timestamp types (`TIMESTAMP_NTZ(p)` / `TIMESTAMP_LTZ(p)`, p in [7, 9]) but had no dedicated test coverage. Add an end-to-end test to `TimestampNanosFunctionsSuiteBase` (run in both ANSI modes) asserting that collect_list preserves the input precision and family (NTZ/LTZ) and the sub-microsecond remainder, drops NULLs, and agrees between the SQL and Scala Column API paths. Also add a deterministic golden SQL case (`sort_array(collect_list(...))`) to `timestamp-ntz-nanos.sql` / `timestamp-ltz-nanos.sql`. Test-only; no production change. Co-authored-by: Isaac
Contributor
Author
|
cc @uros-b, @cloud-fan PTAL when you get a chance. |
uros-b
approved these changes
Aug 12, 2026
Member
|
LGTM, thank you @stevomitric! |
cloud-fan
approved these changes
Aug 12, 2026
cloud-fan
left a comment
Contributor
There was a problem hiding this comment.
0 blocking, 0 non-blocking, 0 nits.
The added coverage matches the existing aggregate contract and generated outputs; no code-review findings remain.
Verification
Inspected the complete changed SQL dossiers and Scala test, then traced the claims to CollectList: its result type is ArrayType(child.dataType, ...), its mutable buffer retains copied Catalyst values, and default collection drops nulls. The generated schemas and outputs preserve NTZ/LTZ precision and sub-microsecond values. No tests were run as part of this review.
PR metadata suggestions
- Document the relationship between the PR's SPARK-58741 ticket and the SPARK-56822 identifiers added to test names and comments, or align the identifiers if SPARK-56822 is not the intended umbrella issue.
Member
|
@stevomitric Please fix lint issues. |
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?
Add an end-to-end test to
TimestampNanosFunctionsSuiteBase(run in both ANSI modes) asserting that collect_list preserves the input precision and family (NTZ/LTZ) and the sub-microsecond remainder, drops NULLs, and agrees between the SQL and Scala Column API paths. Also add a deterministic golden SQL case (sort_array(collect_list(...))) totimestamp-ntz-nanos.sql/timestamp-ltz-nanos.sql.Why are the changes needed?
Extend test coverage for timestamp nanosecond precision datatype.
Does this PR introduce any user-facing change?
No, test only change
How was this patch tested?
Test-only change.
Was this patch authored or co-authored using generative AI tooling?
Co-Authored-by: Claude Code 4.8