Skip to content
  • hyukjinkwon's avatar
    d4d9e17b
    [SPARK-20456][PYTHON][FOLLOWUP] Fix timezone-dependent doctests in unix_timestamp and from_unixtime · d4d9e17b
    hyukjinkwon authored
    ## What changes were proposed in this pull request?
    
    This PR proposes to simply ignore the results in examples that are timezone-dependent in `unix_timestamp` and `from_unixtime`.
    
    ```
    Failed example:
        time_df.select(unix_timestamp('dt', 'yyyy-MM-dd').alias('unix_time')).collect()
    Expected:
        [Row(unix_time=1428476400)]
    Got:unix_timestamp
        [Row(unix_time=1428418800)]
    ```
    
    ```
    Failed example:
        time_df.select(from_unixtime('unix_time').alias('ts')).collect()
    Expected:
        [Row(ts=u'2015-04-08 00:00:00')]
    Got:
        [Row(ts=u'2015-04-08 16:00:00')]
    ```
    
    ## How was this patch tested?
    
    Manually tested and `./run-tests --modules pyspark-sql`.
    
    Author: hyukjinkwon <gurwls223@gmail.com>
    
    Closes #18597 from HyukjinKwon/SPARK-20456.
    d4d9e17b
    [SPARK-20456][PYTHON][FOLLOWUP] Fix timezone-dependent doctests in unix_timestamp and from_unixtime
    hyukjinkwon authored
    ## What changes were proposed in this pull request?
    
    This PR proposes to simply ignore the results in examples that are timezone-dependent in `unix_timestamp` and `from_unixtime`.
    
    ```
    Failed example:
        time_df.select(unix_timestamp('dt', 'yyyy-MM-dd').alias('unix_time')).collect()
    Expected:
        [Row(unix_time=1428476400)]
    Got:unix_timestamp
        [Row(unix_time=1428418800)]
    ```
    
    ```
    Failed example:
        time_df.select(from_unixtime('unix_time').alias('ts')).collect()
    Expected:
        [Row(ts=u'2015-04-08 00:00:00')]
    Got:
        [Row(ts=u'2015-04-08 16:00:00')]
    ```
    
    ## How was this patch tested?
    
    Manually tested and `./run-tests --modules pyspark-sql`.
    
    Author: hyukjinkwon <gurwls223@gmail.com>
    
    Closes #18597 from HyukjinKwon/SPARK-20456.
Loading