Skip to content

Review use of hard-coded UTC assumptions #2730

Closed

Description

@andygrove

What is the problem the feature request solves?

This code pattern worries me. We should fall back to Spark if we do not know the timezone.

spark/src/main/spark-3.5/org/apache/comet/shims/CometExprShim.scala:                .setTimezone(timeZoneId.getOrElse("UTC"))
spark/src/main/spark-4.0/org/apache/comet/shims/CometExprShim.scala:                .setTimezone(timeZoneId.getOrElse("UTC"))
spark/src/main/scala/org/apache/comet/expressions/CometCast.scala:        castBuilder.setTimezone(timeZoneId.getOrElse("UTC"))
spark/src/main/scala/org/apache/comet/serde/structs.scala:              .setTimezone(expr.timeZoneId.getOrElse("UTC"))
spark/src/main/scala/org/apache/comet/serde/datetime.scala:      val timeZone = expr.timeZoneId.getOrElse("UTC")
spark/src/main/scala/org/apache/comet/serde/datetime.scala:      val timeZone = expr.timeZoneId.getOrElse("UTC")
spark/src/main/scala/org/apache/comet/serde/datetime.scala:      val timeZone = expr.timeZoneId.getOrElse("UTC")
spark/src/main/scala/org/apache/comet/serde/datetime.scala:      val timeZone = expr.timeZoneId.getOrElse("UTC")

Describe the potential solution

No response

Additional context

No response

Activity

  1. added this to the 0.12.0 milestone on Nov 7, 2025
  2. self-assigned this
    on Nov 7, 2025
  3. andygrove commented on Nov 7, 2025

    @andygrove
    MemberAuthor

    Also serde.rs to_arrow_datatype has hard-coded UTC.

  4. modified the milestones: 0.12.0, 0.13.0 on Nov 9, 2025
  5. modified the milestones: 0.13.0, 0.14.0 on Jan 30, 2026
  6. removed this from the 0.14.0 milestone on Mar 12, 2026
  7. andygrove commented on Oct 7, 2026

    @andygrove
    MemberAuthor

    All of the timeZoneId.getOrElse("UTC") sites listed here are gone. #6351 replaced them with CometTimeZone.nativeId, which normalizes the timezone each serde passes to native code and reports the expression as unsupported when native code can't represent its timezone, so it falls back or runs in the codegen dispatcher. An expression with no timezone still gets "UTC", but Spark only leaves the timezone unset on casts that don't use it, which the audit in #6335 confirmed across the test suites.

    The hard-coded UTC in to_arrow_datatype is intended. Every TimestampType value in a native plan is labelled Timestamp(Microsecond, "UTC"), and the session timezone travels with each expression instead of with the values. docs/source/contributor-guide/timezones.md describes that model. Closing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions