HyukjinKwon commented on code in PR #36537:
URL: https://github.com/apache/spark/pull/36537#discussion_r872317416
##########
python/pyspark/sql/types.py:
##########
@@ -191,14 +191,25 @@ def needConversion(self):
def toInternal(self, dt):
if dt is not None:
- seconds = (calendar.timegm(dt.utctimetuple()) if dt.tzinfo
- else time.mktime(dt.timetuple()))
+ seconds = 0.0
+ try:
+ seconds = (calendar.timegm(dt.utctimetuple()) if dt.tzinfo
+ else time.mktime(dt.timetuple()))
+ except:
+ # On Windows, the current value is converted to a timestamp
when the current value is less than 1970
+ seconds = (dt -
datetime.datetime.fromtimestamp(int(time.localtime(0).tm_sec) /
1000)).total_seconds()
Review Comment:
Is this Windows specific issue?
--
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]