beliefer commented on code in PR #39514:
URL: https://github.com/apache/spark/pull/39514#discussion_r1066989161
##########
python/pyspark/sql/functions.py:
##########
@@ -4608,9 +4608,11 @@ def hour(col: "ColumnOrName") -> Column:
Examples
--------
>>> import datetime
- >>> df = spark.createDataFrame([(datetime.datetime(2015, 4, 8, 13, 8,
15),)], ['ts'])
+ >>> df = spark.createDataFrame(
+ ... [(datetime.datetime(2015, 4, 8, 13, 8, 15,
tzinfo=datetime.timezone.utc),)], ['ts']
+ ... )
>>> df.select(hour('ts').alias('hour')).collect()
- [Row(hour=13)]
+ [Row(hour=21)]
Review Comment:
Because
https://github.com/apache/spark/blob/7ec5af4c052229dbe94628951df2f67b3036609f/python/pyspark/sql/pandas/types.py#L83
give the timezone=utc for timestamp.
So I explicitly update test cases with timezone utc.
--
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]