stevomitric opened a new pull request, #57992:
URL: https://github.com/apache/spark/pull/57992

   ### What changes were proposed in this pull request?
   
   Add end-to-end regression-lock coverage for `GROUP BY` over the 
nanosecond-precision timestamp types `TIMESTAMP_NTZ(p)` / `TIMESTAMP_LTZ(p)` 
(`p` in `[7, 9]`).
   
   New suite `TimestampNanosGroupBySuiteBase` (with 
`TimestampNanosGroupByAnsiOnSuite` / `TimestampNanosGroupByAnsiOffSuite` 
subclasses), mirroring `TimestampNanosJoinSuiteBase`. For NTZ and LTZ, across 
`p` in `[7, 9]` and both whole-stage-codegen modes, it asserts:
   - GROUP BY keeps two keys that share `epochMicros` but differ within the 
microsecond in separate groups, while collapsing exact duplicates, and computes 
per-group `count` / `sum`;
   - a `UNION` of two different nanos precisions widens the key to the higher 
precision (`findWiderDateTimeType`) and preserves the distinction;
   - NULL keys form a single group (unlike an equi-join, where NULL never 
matches NULL).
   
   Also extends the golden files `timestamp-ntz-nanos.sql` / 
`timestamp-ltz-nanos.sql` with a GROUP-BY-with-aggregates-and-NULL-group case.
   
   ### Why are the changes needed?
   
   GROUP BY on a nanosecond-timestamp key already works today -- it rides on 
the generic nanos hashing/equality implemented in SPARK-57103 (`Murmur3Hash` / 
`XxHash64` / `HiveHash` over the carrier's `epochMicros: Long` and 
`nanosWithinMicro: Short in [0, 999]`) -- but lacked dedicated coverage. These 
tests lock the regression: if the nanos hash or equality path is later broken, 
the sub-microsecond keys collapse and the tests fail loudly. No production 
change.
   
   ### Does this PR introduce _any_ user-facing change?
   
   No. Test-only.
   
   ### How was this patch tested?
   
   `TimestampNanosGroupByAnsiOnSuite` / `TimestampNanosGroupByAnsiOffSuite` (24 
tests, all pass) and the regenerated golden SQL files.
   
   ### Was this patch authored or co-authored using generative AI tooling?
   
   Co-Authored-By: Claude Opus 4.8


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to