Ngone51 commented on a change in pull request #27449:
[SPARK-27297][DOC][FOLLOW-UP] Improve documentation for various Scala functions
URL: https://github.com/apache/spark/pull/27449#discussion_r374586965
##########
File path: sql/core/src/main/scala/org/apache/spark/sql/functions.scala
##########
@@ -3421,6 +3428,14 @@ object functions {
/**
* Returns an array of elements after applying a transformation to each
element
* in the input array.
+ * {{{
+ * df.select(transform(col("i"), (x, i) => x + i))
+ * df.selectExpr("transform(i, (x, i) -> x + i))")
+ * }}}
+ *
+ * @param column the input array column
+ * @param f: (col, index) => transformed_col the lambda function to filter
the input column
+ * given the index. Indices start at 0.
Review comment:
Examples are copied from tests and it starts from 0 if you look at the test
result:
https://github.com/apache/spark/blob/8aebc80e0e67bcb1aa300b8c8b1a209159237632/sql/core/src/test/scala/org/apache/spark/sql/DataFrameFunctionsSuite.scala#L2026
----------------------------------------------------------------
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]
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]