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

   ### What changes were proposed in this pull request?
   Make TIME test-data generation honor the declared `TimeType` precision:
   - `RandomDataGenerator`: in the `case t: TimeType =>` branch, truncate the 
special/interesting TIME values to `t.precision`. Previously only the uniform 
random draw was truncated, while the special values (`00:00:00`, 
`23:59:59.999999`, `23:59:59.999999999`) were emitted unmodified, so the 
interesting-value path produced non-conforming values such as 
`23:59:59.999999999` even for low precisions like `TimeType(0)`.
   - `DataTypeTestUtils.timeTypes`: add an intermediate `TimeType(3)` between 
`MIN_PRECISION` (0) and `MAX_PRECISION` (9), so the suites looping over 
`ordered` / `atomicTypes` / `propertyCheckSupported` actually exercise a 
non-endpoint precision.
   
   `LiteralGenerator.timeLiteralGen` is already precision-aware (landed with 
SPARK-57551), so no change is needed there.
   
   This is the precision-conformance follow-up to SPARK-51403 (TIME as 
ordered/atomic type) and SPARK-51669 (random TIME values in tests). SPARK-57551 
raised `TimeType.MAX_PRECISION` from 6 to 9, widening the gap the generators 
must cover.
   
   ### Why are the changes needed?
   The precision dimension of `DataTypeTestUtils.timeTypes` was effectively not 
exercised: the interesting-value path produced TIME values that do not conform 
to the declared precision, and only the two endpoints (0 and 9) were covered. 
Suites that loop over `ordered` / `atomicTypes` / `propertyCheckSupported` 
(e.g. `PredicateSuite`, `ConditionalExpressionSuite`, 
`ArithmeticExpressionSuite`, `OrderingSuite`, `SortSuite`, `CastSuite`, 
`RandomDataGeneratorSuite`) therefore silently tested a single precision.
   
   ### Does this PR introduce _any_ user-facing change?
   No. This only fixes test data generation; there is no production code or 
versioning change.
   
   ### How was this patch tested?
   By running the affected TIME-covering suites and confirming they pass:
   `RandomDataGeneratorSuite`, `PredicateSuite`, `ConditionalExpressionSuite`, 
`ArithmeticExpressionSuite`, `OrderingSuite`, `CastSuite`, 
`CastWithAnsiOnSuite`, `UnsafeRowSuite`, and `SortSuite`.
   
   ### Was this patch authored or co-authored using generative AI tooling?
   Generated-by: Cursor (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