GitHub user mn-mikke opened a pull request: https://github.com/apache/spark/pull/21298
[SPARK-24198][SparkR][SQL] Adding slice function to SparkR ## What changes were proposed in this pull request? The PR adds the `slice` function to SparkR. The function returns a subset of consecutive elements from the given array. ``` > df <- createDataFrame(cbind(model = rownames(mtcars), mtcars)) > tmp <- mutate(df, v1 = create_array(df$mpg, df$cyl, df$hp)) > head(select(tmp, slice(tmp$v1, 2L, 2L))) ``` ``` slice(v1, 2, 2) 1 6, 110 2 6, 110 3 4, 93 4 6, 110 5 8, 175 6 6, 105 ``` ## How was this patch tested? A test added into R/pkg/tests/fulltests/test_sparkSQL.R You can merge this pull request into a Git repository by running: $ git pull https://github.com/mn-mikke/spark SPARK-24198 Alternatively you can review and apply these changes as the patch at: https://github.com/apache/spark/pull/21298.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #21298 ---- commit fe008dcbeaa996fb48168836bbceedae82662658 Author: Marek Novotny <mn.mikke@...> Date: 2018-05-10T22:06:36Z [SPARK-24198][SparkR][SQL] Adding slice function to SparkR ---- --- --------------------------------------------------------------------- To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org