You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by HyukjinKwon <gi...@git.apache.org> on 2018/04/23 14:59:40 UTC

[GitHub] spark pull request #21130: [SPARK-24054][R] Add array_position function / el...

GitHub user HyukjinKwon opened a pull request:

    https://github.com/apache/spark/pull/21130

    [SPARK-24054][R] Add array_position function / element_at functions

    ## What changes were proposed in this pull request?
    
    This PR proposes to add array_position and element_at in R side too.
    
    array_position:
    
    ```r
    df <- createDataFrame(cbind(model = rownames(mtcars), mtcars))
    mutated <- mutate(df, v1 = create_array(df$gear, df$am, df$carb))
    head(select(mutated, array_position(mutated$v1, 1)))
    ```
    
    ```
      array_position(v1, 1.0)
    1                       2
    2                       2
    3                       2
    4                       3
    5                       0
    6                       3
    ```
    
    element_at:
    
    ```r
    df <- createDataFrame(cbind(model = rownames(mtcars), mtcars))
    mutated <- mutate(df, v1 = create_array(df$mpg, df$cyl, df$hp))
    head(select(mutated, element_at(mutated$v1, 1)))
    ```
    
    ```
      element_at(v1, 1.0)
    1                21.0
    2                21.0
    3                22.8
    4                21.4
    5                18.7
    6                18.1
    ```
    
    ```r
    df <- createDataFrame(cbind(model = rownames(mtcars), mtcars))
    mutated <- mutate(df, v3 = create_map(df$model, df$cyl))
    head(select(mutated, element_at(mutated$v3, "Valiant")))
    ```
    
    ```
      element_at(v3, Valiant)
    1                      NA
    2                      NA
    3                      NA
    4                      NA
    5                      NA
    6                       6
    ```
    
    ## How was this patch tested?
    
    Unit tests were added in `R/pkg/tests/fulltests/test_sparkSQL.R` and manually tested. Documentation was manually built and verified.

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/HyukjinKwon/spark sparkr_array_position_element_at

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/spark/pull/21130.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 #21130
    
----
commit 443034ac3180ea3f18f692040e7be4e6ca11553b
Author: hyukjinkwon <gu...@...>
Date:   2018-04-23T14:11:59Z

    Add array_position function / element_at functions

----


---

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


[GitHub] spark issue #21130: [SPARK-24054][R] Add array_position function / element_a...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the issue:

    https://github.com/apache/spark/pull/21130
  
    **[Test build #89729 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/89729/testReport)** for PR 21130 at commit [`443034a`](https://github.com/apache/spark/commit/443034ac3180ea3f18f692040e7be4e6ca11553b).
     * This patch passes all tests.
     * This patch merges cleanly.
     * This patch adds no public classes.


---

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


[GitHub] spark issue #21130: [SPARK-24054][R] Add array_position function / element_a...

Posted by HyukjinKwon <gi...@git.apache.org>.
Github user HyukjinKwon commented on the issue:

    https://github.com/apache/spark/pull/21130
  
    Thank you for reviewing this @felixcheung and @viirya.


---

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


[GitHub] spark pull request #21130: [SPARK-24054][R] Add array_position function / el...

Posted by viirya <gi...@git.apache.org>.
Github user viirya commented on a diff in the pull request:

    https://github.com/apache/spark/pull/21130#discussion_r183616570
  
    --- Diff: R/pkg/R/functions.R ---
    @@ -189,6 +189,11 @@ NULL
     #'              the map or array of maps.
     #'          \item \code{from_json}: it is the column containing the JSON string.
     #'          }
    +#' @param value A value to compute on.
    +#'          \itemize{
    +#'          \item \code{array_contains}: a value to be checked if contained in the column.
    +#'          \item \code{array_position}: a value to to locate in the given array.
    --- End diff --
    
    typo: `to to`


---

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


[GitHub] spark issue #21130: [SPARK-24054][R] Add array_position function / element_a...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:

    https://github.com/apache/spark/pull/21130
  
    Merged build finished. Test PASSed.


---

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


[GitHub] spark issue #21130: [SPARK-24054][R] Add array_position function / element_a...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the issue:

    https://github.com/apache/spark/pull/21130
  
    **[Test build #89765 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/89765/testReport)** for PR 21130 at commit [`d1d1bb4`](https://github.com/apache/spark/commit/d1d1bb46d88f9c470838588a2198b3a105fabcdb).


---

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


[GitHub] spark pull request #21130: [SPARK-24054][R] Add array_position function / el...

Posted by asfgit <gi...@git.apache.org>.
Github user asfgit closed the pull request at:

    https://github.com/apache/spark/pull/21130


---

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


[GitHub] spark issue #21130: [SPARK-24054][R] Add array_position function / element_a...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:

    https://github.com/apache/spark/pull/21130
  
    Test PASSed.
    Refer to this link for build results (access rights to CI server needed): 
    https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/89729/
    Test PASSed.


---

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


[GitHub] spark issue #21130: [SPARK-24054][R] Add array_position function / element_a...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:

    https://github.com/apache/spark/pull/21130
  
    Merged build finished. Test PASSed.


---

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


[GitHub] spark issue #21130: [SPARK-24054][R] Add array_position function / element_a...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:

    https://github.com/apache/spark/pull/21130
  
    Test PASSed.
    Refer to this link for build results (access rights to CI server needed): 
    https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/89731/
    Test PASSed.


---

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


[GitHub] spark issue #21130: [SPARK-24054][R] Add array_position function / element_a...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:

    https://github.com/apache/spark/pull/21130
  
    Test PASSed.
    Refer to this link for build results (access rights to CI server needed): 
    https://amplab.cs.berkeley.edu/jenkins//job/testing-k8s-prb-make-spark-distribution/2593/
    Test PASSed.


---

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


[GitHub] spark issue #21130: [SPARK-24054][R] Add array_position function / element_a...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:

    https://github.com/apache/spark/pull/21130
  
    Test PASSed.
    Refer to this link for build results (access rights to CI server needed): 
    https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/89765/
    Test PASSed.


---

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


[GitHub] spark issue #21130: [SPARK-24054][R] Add array_position function / element_a...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the issue:

    https://github.com/apache/spark/pull/21130
  
    **[Test build #89731 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/89731/testReport)** for PR 21130 at commit [`7f75f5e`](https://github.com/apache/spark/commit/7f75f5ea1904a038221f227d0691f0e099ae88c0).


---

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


[GitHub] spark issue #21130: [SPARK-24054][R] Add array_position function / element_a...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:

    https://github.com/apache/spark/pull/21130
  
    Test PASSed.
    Refer to this link for build results (access rights to CI server needed): 
    https://amplab.cs.berkeley.edu/jenkins//job/testing-k8s-prb-make-spark-distribution/2594/
    Test PASSed.


---

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


[GitHub] spark issue #21130: [SPARK-24054][R] Add array_position function / element_a...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the issue:

    https://github.com/apache/spark/pull/21130
  
    **[Test build #89731 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/89731/testReport)** for PR 21130 at commit [`7f75f5e`](https://github.com/apache/spark/commit/7f75f5ea1904a038221f227d0691f0e099ae88c0).
     * This patch passes all tests.
     * This patch merges cleanly.
     * This patch adds no public classes.


---

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


[GitHub] spark issue #21130: [SPARK-24054][R] Add array_position function / element_a...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:

    https://github.com/apache/spark/pull/21130
  
    Merged build finished. Test PASSed.


---

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


[GitHub] spark issue #21130: [SPARK-24054][R] Add array_position function / element_a...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:

    https://github.com/apache/spark/pull/21130
  
    Test PASSed.
    Refer to this link for build results (access rights to CI server needed): 
    https://amplab.cs.berkeley.edu/jenkins//job/testing-k8s-prb-make-spark-distribution/2613/
    Test PASSed.


---

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


[GitHub] spark issue #21130: [SPARK-24054][R] Add array_position function / element_a...

Posted by HyukjinKwon <gi...@git.apache.org>.
Github user HyukjinKwon commented on the issue:

    https://github.com/apache/spark/pull/21130
  
    cc @felixcheung, can you take a look please when you are available?


---

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


[GitHub] spark issue #21130: [SPARK-24054][R] Add array_position function / element_a...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:

    https://github.com/apache/spark/pull/21130
  
    Merged build finished. Test PASSed.


---

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


[GitHub] spark issue #21130: [SPARK-24054][R] Add array_position function / element_a...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:

    https://github.com/apache/spark/pull/21130
  
    Merged build finished. Test PASSed.


---

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


[GitHub] spark issue #21130: [SPARK-24054][R] Add array_position function / element_a...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the issue:

    https://github.com/apache/spark/pull/21130
  
    **[Test build #89765 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/89765/testReport)** for PR 21130 at commit [`d1d1bb4`](https://github.com/apache/spark/commit/d1d1bb46d88f9c470838588a2198b3a105fabcdb).
     * This patch passes all tests.
     * This patch merges cleanly.
     * This patch adds no public classes.


---

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


[GitHub] spark issue #21130: [SPARK-24054][R] Add array_position function / element_a...

Posted by viirya <gi...@git.apache.org>.
Github user viirya commented on the issue:

    https://github.com/apache/spark/pull/21130
  
    LGTM except for a tiny typo.


---

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


[GitHub] spark issue #21130: [SPARK-24054][R] Add array_position function / element_a...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:

    https://github.com/apache/spark/pull/21130
  
    Merged build finished. Test PASSed.


---

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


[GitHub] spark issue #21130: [SPARK-24054][R] Add array_position function / element_a...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the issue:

    https://github.com/apache/spark/pull/21130
  
    **[Test build #89729 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/89729/testReport)** for PR 21130 at commit [`443034a`](https://github.com/apache/spark/commit/443034ac3180ea3f18f692040e7be4e6ca11553b).


---

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


[GitHub] spark issue #21130: [SPARK-24054][R] Add array_position function / element_a...

Posted by HyukjinKwon <gi...@git.apache.org>.
Github user HyukjinKwon commented on the issue:

    https://github.com/apache/spark/pull/21130
  
    Merged to master.


---

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