You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by j-bennet <gi...@git.apache.org> on 2017/05/31 17:18:03 UTC

[GitHub] spark issue #18139: [SPARK-20787][PYTHON] PySpark can't handle datetimes bef...

Github user j-bennet commented on the issue:

    https://github.com/apache/spark/pull/18139
  
    The range that mktime will accept is platform-dependent. I am on a Mac, and it looks like mktime can't handle 1900 and 1901:
    
    ```
    Python 2.7.13 (default, Dec 18 2016, 07:03:39)
    Type "copyright", "credits" or "license" for more information.
    
    IPython 5.3.0 -- An enhanced Interactive Python.
    ?         -> Introduction and overview of IPython's features.
    %quickref -> Quick reference.
    help      -> Python's own help system.
    object?   -> Details about 'object', use 'object??' for extra details.
    
    In [1]: import time
    
    In [2]: import datetime as dt
    
    In [3]: time.mktime(dt.datetime(1900, 1, 1).timetuple())
    ---------------------------------------------------------------------------
    OverflowError                             Traceback (most recent call last)
    <ipython-input-3-0332545829df> in <module>()
    ----> 1 time.mktime(dt.datetime(1900, 1, 1).timetuple())
    
    OverflowError: mktime argument out of range
    
    In [4]: time.mktime(dt.datetime(1901, 1, 1).timetuple())
    ---------------------------------------------------------------------------
    OverflowError                             Traceback (most recent call last)
    <ipython-input-4-fb80b633a52b> in <module>()
    ----> 1 time.mktime(dt.datetime(1901, 1, 1).timetuple())
    
    OverflowError: mktime argument out of range
    
    In [5]: time.mktime(dt.datetime(1902, 1, 1).timetuple())
    Out[5]: -2145888000.0
    ```
    
    I would suggest, to be on the safe side, to only call `mktime` for years 1902 and up.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org