HyukjinKwon commented on a change in pull request #33877:
URL: https://github.com/apache/spark/pull/33877#discussion_r703373865



##########
File path: 
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/datetimeExpressions.scala
##########
@@ -708,6 +708,19 @@ case class UnixSeconds(child: Expression) extends 
TimestampToLongBase {
     copy(child = newChild)
 }
 
+// Internal expression used to get the raw UTC timestamp in pandas API on 
Spark.

Review comment:
       The timstamp will be considered as a local timesone and will be 
normalized to UTC internally:
   
   
https://github.com/apache/spark/blob/f2492772baf1d00d802e704f84c22a9c410929e9/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/Cast.scala#L510
   
   e.g.)
   
   ```scala
   scala> sql("SELECT CAST(CAST(TIMESTAMP_NTZ '1970-01-01 00:00:00' AS 
TIMESTAMP) AS LONG)").show()
   +----------------------------------------------------------------------+
   |CAST(CAST(TIMESTAMP_NTZ '1970-01-01 00:00:00' AS TIMESTAMP) AS BIGINT)|
   +----------------------------------------------------------------------+
   |                                                                -32400|
   +----------------------------------------------------------------------+
   ```
   
   This has to be in UTC to mimic pandas' behaviour.




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