HyukjinKwon commented on a change in pull request #30181:
URL: https://github.com/apache/spark/pull/30181#discussion_r514248869
##########
File path: python/pyspark/sql/functions.py
##########
@@ -1059,36 +1236,50 @@ def shiftRightUnsigned(col, numBits):
return Column(jc)
-@since(1.6)
def spark_partition_id():
"""A column for partition ID.
- .. note:: This is indeterministic because it depends on data partitioning
and task scheduling.
+ .. versionadded:: 1.6.0
+ Notes
+ -----
+ This is indeterministic because it depends on data partitioning and task
scheduling.
+
+ Examples
+ --------
>>> df.repartition(1).select(spark_partition_id().alias("pid")).collect()
[Row(pid=0), Row(pid=0)]
"""
sc = SparkContext._active_spark_context
return Column(sc._jvm.functions.spark_partition_id())
-@since(1.5)
def expr(str):
"""Parses the expression string into the column that it represents
+ .. versionadded:: 1.5.0
+
+ Examples
+ --------
>>> df.select(expr("length(name)")).collect()
[Row(length(name)=5), Row(length(name)=3)]
"""
sc = SparkContext._active_spark_context
return Column(sc._jvm.functions.expr(str))
-@since(1.4)
def struct(*cols):
"""Creates a new struct column.
- :param cols: list of column names (string) or list of :class:`Column`
expressions
+ .. versionadded:: 1.4.0
+
+ Parameters
+ ----------
+ cols : list, set, str or :class:`Column`
+ column names or :class:`Column`\\s to contain in the output struct.
Review comment:
There are a bit of trivial changes in the doc to make it more sense with
the new format. One example is here.
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]