Skip to content

[SPARK-58741][SQL][TESTS] Add nanosecond-timestamp coverage for collect_list - #57964

Open
stevomitric wants to merge 2 commits into
apache:masterfrom
stevomitric:stevomitric/nanos-collect-list-tests
Open

[SPARK-58741][SQL][TESTS] Add nanosecond-timestamp coverage for collect_list#57964
stevomitric wants to merge 2 commits into
apache:masterfrom
stevomitric:stevomitric/nanos-collect-list-tests

Conversation

@stevomitric

Copy link
Copy Markdown
Contributor

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(...))) to timestamp-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

…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
@stevomitric stevomitric changed the title [WIP][SPARK-58741][SQL][TESTS] Add nanosecond-timestamp coverage for collect_list [SPARK-58741][SQL][TESTS] Add nanosecond-timestamp coverage for collect_list Aug 12, 2026
@stevomitric

Copy link
Copy Markdown
Contributor Author

cc @uros-b, @cloud-fan PTAL when you get a chance.

@uros-b

uros-b commented Aug 12, 2026

Copy link
Copy Markdown
Member

LGTM, thank you @stevomitric!

@cloud-fan cloud-fan left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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.

@uros-b

uros-b commented Aug 12, 2026

Copy link
Copy Markdown
Member

@stevomitric Please fix lint issues.

Reflow over-long comment lines in TimestampNanosFunctionsSuiteBase to
stay within the 100-character limit. Comment-only change.

Co-authored-by: Isaac
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.

3 participants