HyukjinKwon commented on code in PR #36537:
URL: https://github.com/apache/spark/pull/36537#discussion_r873297554


##########
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:
   IIRC 1970 handling issue is not OS specific problem. It would be great if 
you link some reported issues related to that.



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