Commit ac3a055
[SPARK-32088][PYTHON] Pin the timezone in timestamp_seconds doctest
### What changes were proposed in this pull request?
Add American timezone during timestamp_seconds doctest
### Why are the changes needed?
`timestamp_seconds` doctest in `functions.py` used default timezone to get expected result
For example:
```python
>>> time_df = spark.createDataFrame([(1230219000,)], ['unix_time'])
>>> time_df.select(timestamp_seconds(time_df.unix_time).alias('ts')).collect()
[Row(ts=datetime.datetime(2008, 12, 25, 7, 30))]
```
But when we have a non-american timezone, the test case will get different test result.
For example, when we set current timezone as `Asia/Shanghai`, the test result will be
```
[Row(ts=datetime.datetime(2008, 12, 25, 23, 30))]
```
So no matter where we run the test case ,we will always get the expected permanent result if we set the timezone on one specific area.
### Does this PR introduce _any_ user-facing change?
No
### How was this patch tested?
Unit test
Closes apache#28932 from GuoPhilipse/SPARK-32088-fix-timezone-issue.
Lead-authored-by: GuoPhilipse <[email protected]>
Co-authored-by: GuoPhilipse <[email protected]>
Signed-off-by: Dongjoon Hyun <[email protected]>1 parent 8795133 commit ac3a055
File tree
2 files changed
+4
-2
lines changed- python/pyspark/sql
- sql/core/src/main/scala/org/apache/spark/sql
2 files changed
+4
-2
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1431 | 1431 | | |
1432 | 1432 | | |
1433 | 1433 | | |
| 1434 | + | |
1434 | 1435 | | |
1435 | 1436 | | |
1436 | 1437 | | |
| 1438 | + | |
1437 | 1439 | | |
1438 | 1440 | | |
1439 | 1441 | | |
| |||
Lines changed: 2 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3360 | 3360 | | |
3361 | 3361 | | |
3362 | 3362 | | |
3363 | | - | |
3364 | | - | |
| 3363 | + | |
| 3364 | + | |
3365 | 3365 | | |
3366 | 3366 | | |
3367 | 3367 | | |
| |||
0 commit comments