davidm-db commented on code in PR #56449:
URL: https://github.com/apache/spark/pull/56449#discussion_r3408433133
##########
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/types/ops/TypeOps.scala:
##########
@@ -37,6 +38,12 @@ import org.apache.spark.sql.types.{DataType,
TimestampLTZNanosType, TimestampNTZ
* implemented by every type. Optional methods (serialization, Arrow writer)
return Option and
* default to None - types implement them as they expand their integration
coverage.
*
+ * Extends [[TypeApiOps]] (the api-side trait) so that callers holding an
`Option[TypeOps]` can
+ * invoke client-side methods (`format`, `toSQLValue`, `getEncoder`, ...)
directly via `.map`,
Review Comment:
Went with your first option — `TimestampLTZNanosTypeApiOps`'s `zoneId` is
now by-name and the catalyst `TimestampLTZNanosTypeOps` passes the
session-local zone lazily instead of `ZoneOffset.UTC`, so rendering an LTZ
through `TypeOps` uses the session zone (on first render) rather than silently
UTC.
Kept `TypeApiOps.apply` by-name so non-rendering constructions
(`getEncoder`, `thriftTypeName`, serde) don't fetch the config, and had the
cast-to-string codegen resolve the cast's already-baked zone into a local
before building the reference object, so it holds a `ZoneId` rather than
capturing the `Cast`.
Also applied the `narrow` -> `narrowing` wording. Thanks!
--
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]