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 2020/07/17 01:54:10 UTC

[GitHub] [spark] ueshin commented on a change in pull request #29138: [SPARK-32338] [SQL] Overload slice to accept Column for start and length

ueshin commented on a change in pull request #29138:
URL: https://github.com/apache/spark/pull/29138#discussion_r456173962



##########
File path: sql/core/src/main/scala/org/apache/spark/sql/functions.scala
##########
@@ -3406,6 +3406,24 @@ object functions {
     Slice(x.expr, Literal(start), Literal(length))
   }
 
+  /**
+   * Returns an array containing all the elements in `x` from index `start` (or starting from the
+   * end if `start` is negative) with the specified `length`.
+   *
+   * @param x the array column to be sliced
+   * @param start the starting index
+   * @param length the length of the slice
+   *
+   * @group collection_funcs
+   * @since 2.4.0

Review comment:
       `3.1.0`?

##########
File path: sql/core/src/main/scala/org/apache/spark/sql/functions.scala
##########
@@ -3406,6 +3406,24 @@ object functions {
     Slice(x.expr, Literal(start), Literal(length))
   }
 
+  /**
+   * Returns an array containing all the elements in `x` from index `start` (or starting from the
+   * end if `start` is negative) with the specified `length`.
+   *
+   * @param x the array column to be sliced
+   * @param start the starting index
+   * @param length the length of the slice
+   *
+   * @group collection_funcs
+   * @since 2.4.0
+   */
+  def slice(x: Column, start: Any, length: Any): Column = (start, length) match {

Review comment:
       I'm afraid I don't think we should use `Any` here.
   Maybe `def slice(x: Column, start: Column, length: Column): Column` is good enough?




----------------------------------------------------------------
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:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org