canyang25 commented on code in PR #59298:
URL: https://github.com/apache/spark/pull/59298#discussion_r4236641834


##########
python/pyspark/sql/types.py:
##########
@@ -492,9 +492,7 @@ def needConversion(self) -> bool:
 
     def toInternal(self, dt: datetime.datetime) -> int:
         if dt is not None:
-            seconds = (
-                calendar.timegm(dt.utctimetuple()) if dt.tzinfo else 
time.mktime(dt.timetuple())
-            )
+            seconds = calendar.timegm(dt.utctimetuple()) if dt.tzinfo else 
dt.timestamp()

Review Comment:
   Fixed. The new _naive_dt_to_epoch_seconds helper uses 
dt.replace(microsecond=0).timestamp(), so microseconds are added once. Covered 
by test_naive_timestamp_to_internal_pre_1970_microseconds.



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