You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by GitBox <gi...@apache.org> on 2023/01/11 13:25:23 UTC
[GitHub] [spark] beliefer commented on a diff in pull request #39514: [SPARK-41987][CONNECT][PYTHON] createDataFrame supports column with map type
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: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org