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 2021/10/25 02:35:29 UTC
[GitHub] [spark] yoda-mon commented on a change in pull request #34356: [SPARK-36554][PYTHON] Expose make_date expression in functions.scala
yoda-mon commented on a change in pull request #34356:
URL: https://github.com/apache/spark/pull/34356#discussion_r735220881
##########
File path: python/pyspark/sql/functions.py
##########
@@ -2131,6 +2131,24 @@ def weekofyear(col: "ColumnOrName") -> Column:
return Column(sc._jvm.functions.weekofyear(_to_java_column(col)))
+def make_date(year: "ColumnOrName", month: "ColumnOrName", day: "ColumnOrName") -> Column:
+ """
+ Returns a column with date built from the year, month and day columns.
+
+ Examples
+ --------
+ >>> df = spark.createDataFrame([(2020, 6, 26)], ['Y', 'M', 'D'])
+ >>> df.select(make_date(df.Y, df.M, df.D).alias("datefield")).collect()
+ [Row(datefield=datetime.date(2020, 6, 26))]
Review comment:
Isn't it better to add
- `Parameter`
- `Returns`
section and
- `versionadd`
directives ?
--
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