canyang25 commented on code in PR #59298:
URL: https://github.com/apache/spark/pull/59298#discussion_r4239808375
##########
python/pyspark/sql/types.py:
##########
@@ -492,10 +518,11 @@ 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())
- )
- return int(seconds) * 1000000 + dt.microsecond
+ if dt.tzinfo:
+ seconds = calendar.timegm(dt.utctimetuple())
+ else:
+ seconds = _naive_dt_to_epoch_seconds(dt)
Review Comment:
Fixed. DatetimeConverter now uses _naive_dt_to_epoch_seconds for naive
values. Covered by test_datetime_converter_preserves_dst_fold and
test_lit_equals_create_dataframe_dst_fold.
--
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]