acruise commented on code in PR #55893:
URL: https://github.com/apache/spark/pull/55893#discussion_r3249886903


##########
sql/api/src/main/scala/org/apache/spark/sql/catalyst/util/SparkDateTimeUtils.scala:
##########
@@ -228,11 +228,16 @@ trait SparkDateTimeUtils {
 
   /**
    * Converts days since 1970-01-01 at the given zone ID to microseconds since 
1970-01-01
-   * 00:00:00Z.
+   * 00:00:00Z. When `zoneId eq ZoneOffset.UTC`, takes a direct-multiply fast 
path that skips the
+   * `LocalDate`/`ZonedDateTime`/`Instant` chain.
    */
   def daysToMicros(days: Int, zoneId: ZoneId): Long = {
-    val instant = daysToLocalDate(days).atStartOfDay(zoneId).toInstant
-    instantToMicros(instant)
+    if (zoneId eq ZoneOffset.UTC) {

Review Comment:
   Just out of curiosity, is there a version of this that takes an arbitrary 
offset (e.g. in seconds) vs. a nominal zone ID? The distinction _hardly ever_ 
matters, except when various jurisdictions change their timezone rules. For 
example, here in British Columbia, we have officially stopped doing DST 
changes! 😅 



-- 
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