MaxGekk commented on code in PR #56577:
URL: https://github.com/apache/spark/pull/56577#discussion_r3435356981
##########
sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/expressions/CastSuiteBase.scala:
##########
@@ -1398,6 +1457,143 @@ abstract class CastSuiteBase extends SparkFunSuite with
ExpressionEvalHelper {
}
}
+ test("cross-family nanos cast: timestamp_ltz to timestamp_ntz") {
+ // LTZ(p) denotes an absolute instant; LTZ(p) -> NTZ(q) renders it as the
wall-clock local
+ // date-time observed in the session zone (mirroring the micro TIMESTAMP
-> TIMESTAMP_NTZ
+ // conversion on the epoch-micros part) and re-floors the sub-microsecond
digits to q.
+ Seq(UTC, LA).foreach { zone =>
Review Comment:
Both addressed in 1d2b271.
Added a dedicated test `cross-family nanos cast: DST gap and overlap resolve
like the micro cast` covering the LA spring-forward gap (`2020-03-08 02:30` ->
shifted forward) and fall-back overlap (`2020-11-01 01:30` -> earlier offset).
For each `p, q in [7, 9]` it asserts the nanos `NTZ(q) -> LTZ(p)` and `LTZ(p)
-> NTZ(q)` results match the production micro `TIMESTAMP_NTZ <-> TIMESTAMP`
cast on the epoch-micros part (the expected micro values are obtained via
`evaluateWithoutCodegen`, so the parity is against the real cast rather than a
re-derivation).
Also added `assert(!Cast.forceNullable(from, to))` to both cross-family
contract tests (the nanos<->nanos one and the precision-6 micro-boundary one),
mirroring the null-safe micro pair.
--
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]