You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by huaxingao <gi...@git.apache.org> on 2018/06/27 19:57:25 UTC

[GitHub] spark pull request #21649: SPARK[23648][R][SQL]Adds more types for hint in S...

GitHub user huaxingao opened a pull request:

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

    SPARK[23648][R][SQL]Adds more types for hint in SparkR

    ## What changes were proposed in this pull request?
    
    Addition of numeric and list hints for  SparkR.
    
    ## How was this patch tested?
    Add test in test_sparkSQL.R
    
    
    Please review http://spark.apache.org/contributing.html before opening a pull request.


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

    $ git pull https://github.com/huaxingao/spark spark-23648

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

    https://github.com/apache/spark/pull/21649.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 #21649
    
----
commit 009f82c984c559b68169bb1944d2921b0c218e9e
Author: Huaxin Gao <hu...@...>
Date:   2018-06-27T19:48:44Z

    SPARK[23648][R][SQL]Adds more types for hint in SparkR

----


---

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


[GitHub] spark pull request #21649: [SPARK-23648][R][SQL]Adds more types for hint in ...

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

    https://github.com/apache/spark/pull/21649#discussion_r199328470
  
    --- Diff: R/pkg/R/DataFrame.R ---
    @@ -3905,6 +3905,16 @@ setMethod("rollup",
                 groupedData(sgd)
               })
     
    +isTypeAllowedForSqlHint <- function(x) {
    +  if (is.character(x) | is.numeric(x)) {
    +    TRUE
    +  } else if (is.list(x)) {
    +    all (sapply(x, (function (y) is.character(y) | is.numeric(y))))
    +  } else {
    +    FALSE
    +  }
    +}
    +
     #' hint
     #'
     #' Specifies execution plan hint and return a new SparkDataFrame.
    --- End diff --
    
    does scala have any doc on hint type supported?


---

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


[GitHub] spark pull request #21649: [SPARK-23648][R][SQL]Adds more types for hint in ...

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

    https://github.com/apache/spark/pull/21649#discussion_r216727458
  
    --- Diff: R/pkg/R/DataFrame.R ---
    @@ -3939,7 +3929,15 @@ setMethod("hint",
               signature(x = "SparkDataFrame", name = "character"),
               function(x, name, ...) {
                 parameters <- list(...)
    -            stopifnot(all(sapply(parameters, isTypeAllowedForSqlHint)))
    +            stopifnot(all(sapply(parameters, function(x) {
    --- End diff --
    
    My bad. Will change. 


---

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


[GitHub] spark pull request #21649: [SPARK-23648][R][SQL]Adds more types for hint in ...

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

    https://github.com/apache/spark/pull/21649#discussion_r199327384
  
    --- Diff: R/pkg/R/DataFrame.R ---
    @@ -3905,6 +3905,18 @@ setMethod("rollup",
                 groupedData(sgd)
               })
     
    +isTypeAllowed <- function(x) {
    +  if (is.character(x)) {
    +    TRUE
    +  } else if (is.list(x)) {
    --- End diff --
    
    Thanks. I will make changes. 


---

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


[GitHub] spark pull request #21649: [SPARK-23648][R][SQL]Adds more types for hint in ...

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

    https://github.com/apache/spark/pull/21649#discussion_r198913351
  
    --- Diff: R/pkg/tests/fulltests/test_sparkSQL.R ---
    @@ -2370,6 +2370,15 @@ test_that("join(), crossJoin() and merge() on a DataFrame", {
       expect_true(any(grepl("BroadcastHashJoin", execution_plan_broadcast)))
     })
     
    +test_that("test hint", {
    --- End diff --
    
    The previous test with join broadcast hint is for test "join(), crossJoin() and merge() on a DataFrame". It seems to me that a simple sql hint test doesn't belong to that catalog. I guess it might be better to separate.  What do you think? 


---

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


[GitHub] spark issue #21649: [SPARK-23648][R][SQL]Adds more types for hint in SparkR

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

    https://github.com/apache/spark/pull/21649
  
    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-unified/602/
    Test PASSed.


---

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


[GitHub] spark pull request #21649: [SPARK-23648][R][SQL]Adds more types for hint in ...

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

    https://github.com/apache/spark/pull/21649#discussion_r198913230
  
    --- Diff: R/pkg/R/DataFrame.R ---
    @@ -3905,6 +3905,18 @@ setMethod("rollup",
                 groupedData(sgd)
               })
     
    +isTypeAllowed <- function(x) {
    +  if (is.character(x)) {
    +    TRUE
    +  } else if (is.list(x)) {
    --- End diff --
    
    @felixcheung Thank you very much for your review! I don't think database will use nested list for sql hints, but I can change the code to 
    ```
    isTypeAllowedForSqlHint <- function(x) {
      if (is.character(x)) {
        TRUE
      } else if (is.list(x)) {
        all(sapply(x, isTypeAllowedForSqlHint))
      } else if (is.numeric(x)) {
        TRUE
      } else {
        FALSE
      }
    }
    ```
    Does this look good to you?


---

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


[GitHub] spark issue #21649: [SPARK-23648][R][SQL]Adds more types for hint in SparkR

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

    https://github.com/apache/spark/pull/21649
  
    **[Test build #92574 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/92574/testReport)** for PR 21649 at commit [`aec391c`](https://github.com/apache/spark/commit/aec391c9dcb6362874736e663d435f9dd8400125).
     * 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 #21649: [SPARK-23648][R][SQL]Adds more types for hint in SparkR

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

    https://github.com/apache/spark/pull/21649
  
    @felixcheung Thanks for your comments. I changed ```stopifnot```. At L3925 I could add 
    ```
    hintList <- list("hint2", "hint3", "hint4")
    hint(df, "hint1", 1.2345, hintList)
    ```
    but I am a little hesitated to give an example. Even though we relax the check for hint, I am not sure how the numeric hint or list hint is used in real sql. 


---

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


[GitHub] spark issue #21649: [SPARK-23648][R][SQL]Adds more types for hint in SparkR

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

    https://github.com/apache/spark/pull/21649
  
    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 #21649: [SPARK-23648][R][SQL]Adds more types for hint in SparkR

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

    https://github.com/apache/spark/pull/21649
  
    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 #21649: [SPARK-23648][R][SQL]Adds more types for hint in SparkR

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

    https://github.com/apache/spark/pull/21649
  
    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-unified/645/
    Test PASSed.


---

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


[GitHub] spark issue #21649: [SPARK-23648][R][SQL]Adds more types for hint in SparkR

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

    https://github.com/apache/spark/pull/21649
  
    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 #21649: [SPARK-23648][R][SQL]Adds more types for hint in SparkR

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

    https://github.com/apache/spark/pull/21649
  
    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 #21649: [SPARK-23648][R][SQL]Adds more types for hint in SparkR

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

    https://github.com/apache/spark/pull/21649
  
    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 #21649: [SPARK-23648][R][SQL]Adds more types for hint in SparkR

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

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


---

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


[GitHub] spark issue #21649: [SPARK-23648][R][SQL]Adds more types for hint in SparkR

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

    https://github.com/apache/spark/pull/21649
  
    **[Test build #95888 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/95888/testReport)** for PR 21649 at commit [`8a52e50`](https://github.com/apache/spark/commit/8a52e50737b778b6b6aa56010af7b7c0a9fd0d7f).
     * 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 pull request #21649: [SPARK-23648][R][SQL]Adds more types for hint in ...

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

    https://github.com/apache/spark/pull/21649#discussion_r199328430
  
    --- Diff: R/pkg/R/DataFrame.R ---
    @@ -3905,6 +3905,16 @@ setMethod("rollup",
                 groupedData(sgd)
               })
     
    +isTypeAllowedForSqlHint <- function(x) {
    +  if (is.character(x) | is.numeric(x)) {
    +    TRUE
    +  } else if (is.list(x)) {
    +    all (sapply(x, (function (y) is.character(y) | is.numeric(y))))
    --- End diff --
    
    ditto here


---

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


[GitHub] spark issue #21649: [SPARK-23648][R][SQL]Adds more types for hint in SparkR

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

    https://github.com/apache/spark/pull/21649
  
    Right - I think we could inline it or simplify it further.
    
    ________________________________
    



---

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


[GitHub] spark pull request #21649: [SPARK-23648][R][SQL]Adds more types for hint in ...

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

    https://github.com/apache/spark/pull/21649#discussion_r216539767
  
    --- Diff: R/pkg/R/DataFrame.R ---
    @@ -3939,7 +3929,15 @@ setMethod("hint",
               signature(x = "SparkDataFrame", name = "character"),
               function(x, name, ...) {
                 parameters <- list(...)
    -            stopifnot(all(sapply(parameters, isTypeAllowedForSqlHint)))
    +            stopifnot(all(sapply(parameters, function(x) {
    --- End diff --
    
    if recall, let's not have a inside scope with the same variable name `x` in the outer scope?


---

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


[GitHub] spark issue #21649: [SPARK-23648][R][SQL]Adds more types for hint in SparkR

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

    https://github.com/apache/spark/pull/21649
  
    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 pull request #21649: [SPARK-23648][R][SQL]Adds more types for hint in ...

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

    https://github.com/apache/spark/pull/21649#discussion_r199328450
  
    --- Diff: R/pkg/R/DataFrame.R ---
    @@ -3905,6 +3905,16 @@ setMethod("rollup",
                 groupedData(sgd)
               })
     
    +isTypeAllowedForSqlHint <- function(x) {
    +  if (is.character(x) | is.numeric(x)) {
    +    TRUE
    +  } else if (is.list(x)) {
    +    all (sapply(x, (function (y) is.character(y) | is.numeric(y))))
    --- End diff --
    
    also, no space after `all` - it's really `all()`


---

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


[GitHub] spark pull request #21649: [SPARK-23648][R][SQL]Adds more types for hint in ...

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

    https://github.com/apache/spark/pull/21649#discussion_r199706822
  
    --- Diff: R/pkg/R/DataFrame.R ---
    @@ -3905,6 +3905,16 @@ setMethod("rollup",
                 groupedData(sgd)
               })
     
    +isTypeAllowedForSqlHint <- function(x) {
    +  if (is.character(x) | is.numeric(x)) {
    +    TRUE
    +  } else if (is.list(x)) {
    +    all (sapply(x, (function (y) is.character(y) | is.numeric(y))))
    +  } else {
    +    FALSE
    +  }
    +}
    +
     #' hint
     #'
     #' Specifies execution plan hint and return a new SparkDataFrame.
    --- End diff --
    
    the concern would be if other types in python or R are going to be translated/mapped properly to Java/Scala types, so this is probably ok


---

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


[GitHub] spark issue #21649: [SPARK-23648][R][SQL]Adds more types for hint in SparkR

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

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


---

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


[GitHub] spark issue #21649: [SPARK-23648][R][SQL]Adds more types for hint in SparkR

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

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


---

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


[GitHub] spark issue #21649: [SPARK-23648][R][SQL]Adds more types for hint in SparkR

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

    https://github.com/apache/spark/pull/21649
  
    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 #21649: [SPARK-23648][R][SQL]Adds more types for hint in SparkR

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

    https://github.com/apache/spark/pull/21649
  
    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 #21649: [SPARK-23648][R][SQL]Adds more types for hint in SparkR

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

    https://github.com/apache/spark/pull/21649
  
    **[Test build #95888 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/95888/testReport)** for PR 21649 at commit [`8a52e50`](https://github.com/apache/spark/commit/8a52e50737b778b6b6aa56010af7b7c0a9fd0d7f).


---

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


[GitHub] spark pull request #21649: [SPARK-23648][R][SQL]Adds more types for hint in ...

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

    https://github.com/apache/spark/pull/21649#discussion_r198722124
  
    --- Diff: R/pkg/tests/fulltests/test_sparkSQL.R ---
    @@ -2370,6 +2370,15 @@ test_that("join(), crossJoin() and merge() on a DataFrame", {
       expect_true(any(grepl("BroadcastHashJoin", execution_plan_broadcast)))
     })
     
    +test_that("test hint", {
    --- End diff --
    
    merge this with the previous test - less test set is preferred


---

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


[GitHub] spark issue #21649: SPARK[23648][R][SQL]Adds more types for hint in SparkR

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

    https://github.com/apache/spark/pull/21649
  
    **[Test build #92394 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/92394/testReport)** for PR 21649 at commit [`009f82c`](https://github.com/apache/spark/commit/009f82c984c559b68169bb1944d2921b0c218e9e).


---

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


[GitHub] spark pull request #21649: [SPARK-23648][R][SQL]Adds more types for hint in ...

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

    https://github.com/apache/spark/pull/21649#discussion_r216122842
  
    --- Diff: R/pkg/R/DataFrame.R ---
    @@ -3905,6 +3905,16 @@ setMethod("rollup",
                 groupedData(sgd)
               })
     
    +isTypeAllowedForSqlHint <- function(x) {
    +  if (is.character(x) || is.numeric(x)) {
    +    TRUE
    +  } else if (is.list(x)) {
    +    all(sapply(x, (function(y) is.character(y) || is.numeric(y))))
    --- End diff --
    
    also, if it is a `list` could we clarify if it is supposed to work with multiple hint in different types in that list (this might be "unique" to R), for example
    
    ```
    > x <- list("a", 3)
    > all(sapply(x, function(y) { is.character(y) || is.numeric(y) } ))
    [1] TRUE
    
    > x <- list("a", NA)
    > all(sapply(x, function(y) { is.character(y) || is.numeric(y) } ))
    [1] FALSE
    ```


---

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


[GitHub] spark issue #21649: [SPARK-23648][R][SQL]Adds more types for hint in SparkR

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

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


---

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


[GitHub] spark pull request #21649: [SPARK-23648][R][SQL]Adds more types for hint in ...

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

    https://github.com/apache/spark/pull/21649#discussion_r198722458
  
    --- Diff: R/pkg/R/DataFrame.R ---
    @@ -3905,6 +3905,18 @@ setMethod("rollup",
                 groupedData(sgd)
               })
     
    +isTypeAllowed <- function(x) {
    --- End diff --
    
    or define this inline instead-  this is simple enough


---

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


[GitHub] spark pull request #21649: [SPARK-23648][R][SQL]Adds more types for hint in ...

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

    https://github.com/apache/spark/pull/21649#discussion_r216413819
  
    --- Diff: R/pkg/R/DataFrame.R ---
    @@ -3905,6 +3905,16 @@ setMethod("rollup",
                 groupedData(sgd)
               })
     
    +isTypeAllowedForSqlHint <- function(x) {
    +  if (is.character(x) || is.numeric(x)) {
    +    TRUE
    +  } else if (is.list(x)) {
    +    all(sapply(x, (function(y) is.character(y) || is.numeric(y))))
    --- End diff --
    
    I think multiple hint in different types in a single list works OK. I tested 
    ```df.hint("hint1", Seq(1, 2, "a"))``` in scala, it works OK. 


---

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


[GitHub] spark issue #21649: [SPARK-23648][R][SQL]Adds more types for hint in SparkR

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

    https://github.com/apache/spark/pull/21649
  
    **[Test build #92500 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/92500/testReport)** for PR 21649 at commit [`d323dd0`](https://github.com/apache/spark/commit/d323dd00916957abb48a31440c3274c3877e5401).
     * 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 pull request #21649: [SPARK-23648][R][SQL]Adds more types for hint in ...

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

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


---

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


[GitHub] spark issue #21649: [SPARK-23648][R][SQL]Adds more types for hint in SparkR

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

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


---

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


[GitHub] spark issue #21649: [SPARK-23648][R][SQL]Adds more types for hint in SparkR

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

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


---

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


[GitHub] spark issue #21649: [SPARK-23648][R][SQL]Adds more types for hint in SparkR

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

    https://github.com/apache/spark/pull/21649
  
    **[Test build #95956 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/95956/testReport)** for PR 21649 at commit [`f437bd9`](https://github.com/apache/spark/commit/f437bd9f3880d1f88f51bd2d5dfe3648d52c53d7).
     * 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 #21649: [SPARK-23648][R][SQL]Adds more types for hint in SparkR

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

    https://github.com/apache/spark/pull/21649
  
    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 #21649: [SPARK-23648][R][SQL]Adds more types for hint in SparkR

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

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


---

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


[GitHub] spark issue #21649: [SPARK-23648][R][SQL]Adds more types for hint in SparkR

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

    https://github.com/apache/spark/pull/21649
  
    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-unified/522/
    Test PASSed.


---

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


[GitHub] spark issue #21649: [SPARK-23648][R][SQL]Adds more types for hint in SparkR

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

    https://github.com/apache/spark/pull/21649
  
    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-unified/2983/
    Test PASSed.


---

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


[GitHub] spark pull request #21649: [SPARK-23648][R][SQL]Adds more types for hint in ...

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

    https://github.com/apache/spark/pull/21649#discussion_r199328269
  
    --- Diff: R/pkg/tests/fulltests/test_sparkSQL.R ---
    @@ -2370,6 +2370,15 @@ test_that("join(), crossJoin() and merge() on a DataFrame", {
       expect_true(any(grepl("BroadcastHashJoin", execution_plan_broadcast)))
     })
     
    +test_that("test hint", {
    --- End diff --
    
    ok


---

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


[GitHub] spark pull request #21649: [SPARK-23648][R][SQL]Adds more types for hint in ...

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

    https://github.com/apache/spark/pull/21649#discussion_r199313334
  
    --- Diff: R/pkg/R/DataFrame.R ---
    @@ -3905,6 +3905,18 @@ setMethod("rollup",
                 groupedData(sgd)
               })
     
    +isTypeAllowed <- function(x) {
    +  if (is.character(x)) {
    +    TRUE
    +  } else if (is.list(x)) {
    --- End diff --
    
    I'd actually prefer to be more restrictive.. maybe just one level, unless we know of a real need for nested list?


---

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


[GitHub] spark issue #21649: [SPARK-23648][R][SQL]Adds more types for hint in SparkR

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

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


---

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


[GitHub] spark issue #21649: [SPARK-23648][R][SQL]Adds more types for hint in SparkR

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

    https://github.com/apache/spark/pull/21649
  
    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-unified/3166/
    Test PASSed.


---

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


[GitHub] spark pull request #21649: [SPARK-23648][R][SQL]Adds more types for hint in ...

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

    https://github.com/apache/spark/pull/21649#discussion_r198722311
  
    --- Diff: R/pkg/R/DataFrame.R ---
    @@ -3905,6 +3905,18 @@ setMethod("rollup",
                 groupedData(sgd)
               })
     
    +isTypeAllowed <- function(x) {
    --- End diff --
    
    this is specific to hint types right? let's clarify that in the func name?


---

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


[GitHub] spark issue #21649: [SPARK-23648][R][SQL]Adds more types for hint in SparkR

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

    https://github.com/apache/spark/pull/21649
  
    **[Test build #92394 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/92394/testReport)** for PR 21649 at commit [`009f82c`](https://github.com/apache/spark/commit/009f82c984c559b68169bb1944d2921b0c218e9e).
     * 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 pull request #21649: [SPARK-23648][R][SQL]Adds more types for hint in ...

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

    https://github.com/apache/spark/pull/21649#discussion_r216122804
  
    --- Diff: R/pkg/R/DataFrame.R ---
    @@ -3905,6 +3905,16 @@ setMethod("rollup",
                 groupedData(sgd)
               })
     
    +isTypeAllowedForSqlHint <- function(x) {
    +  if (is.character(x) || is.numeric(x)) {
    +    TRUE
    +  } else if (is.list(x)) {
    +    all(sapply(x, (function(y) is.character(y) || is.numeric(y))))
    --- End diff --
    
    I look into this more deeply, I think this style seems a bit odd, as a nit, I think this should be
    
    `all(sapply(x, function(y) { is.character(y) || is.numeric(y) } ))` 
    
    think it's more readable this way. also see L2458 for an example https://github.com/apache/spark/blob/aec391c9dcb6362874736e663d435f9dd8400125/R/pkg/R/DataFrame.R#L2458


---

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


[GitHub] spark issue #21649: [SPARK-23648][R][SQL]Adds more types for hint in SparkR

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

    https://github.com/apache/spark/pull/21649
  
    @felixcheung 
    Are there any other things I need to change? If not, could this PR be merged in 2.4? Thanks!


---

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


[GitHub] spark issue #21649: [SPARK-23648][R][SQL]Adds more types for hint in SparkR

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

    https://github.com/apache/spark/pull/21649
  
    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 #21649: [SPARK-23648][R][SQL]Adds more types for hint in SparkR

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

    https://github.com/apache/spark/pull/21649
  
    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 #21649: [SPARK-23648][R][SQL]Adds more types for hint in SparkR

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

    https://github.com/apache/spark/pull/21649
  
    merged to master, thx


---

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


[GitHub] spark pull request #21649: [SPARK-23648][R][SQL]Adds more types for hint in ...

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

    https://github.com/apache/spark/pull/21649#discussion_r199338975
  
    --- Diff: R/pkg/R/DataFrame.R ---
    @@ -3905,6 +3905,16 @@ setMethod("rollup",
                 groupedData(sgd)
               })
     
    +isTypeAllowedForSqlHint <- function(x) {
    +  if (is.character(x) | is.numeric(x)) {
    +    TRUE
    +  } else if (is.list(x)) {
    +    all (sapply(x, (function (y) is.character(y) | is.numeric(y))))
    +  } else {
    +    FALSE
    +  }
    +}
    +
     #' hint
     #'
     #' Specifies execution plan hint and return a new SparkDataFrame.
    --- End diff --
    
    Scala doesn't have a doc on hint type supported. Actually it has type Any in the signature. 
    ```
    def hint(name: String, parameters: Any*): Dataset[T]
    ```
    I was trying to follow the python implementation in #20788, which allows ```basestring, list, float, int, dict.```Now I am kind of suspect if this is the right behavior. Should we allow any types? 


---

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


[GitHub] spark pull request #21649: [SPARK-23648][R][SQL]Adds more types for hint in ...

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

    https://github.com/apache/spark/pull/21649#discussion_r216185288
  
    --- Diff: R/pkg/R/DataFrame.R ---
    @@ -3905,6 +3905,16 @@ setMethod("rollup",
                 groupedData(sgd)
               })
     
    +isTypeAllowedForSqlHint <- function(x) {
    --- End diff --
    
    This is only used once BTW. Shall we just put this into the inside of `hint`?


---

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


[GitHub] spark pull request #21649: [SPARK-23648][R][SQL]Adds more types for hint in ...

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

    https://github.com/apache/spark/pull/21649#discussion_r199225907
  
    --- Diff: R/pkg/R/DataFrame.R ---
    @@ -3905,6 +3905,18 @@ setMethod("rollup",
                 groupedData(sgd)
               })
     
    +isTypeAllowed <- function(x) {
    +  if (is.character(x)) {
    +    TRUE
    +  } else if (is.list(x)) {
    --- End diff --
    
    I guess we should make the nested list work, but in real usage, only one level of list will be used in sql hint and the code will stop after checking the first level of list. 


---

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


[GitHub] spark issue #21649: [SPARK-23648][R][SQL]Adds more types for hint in SparkR

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

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


---

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


[GitHub] spark issue #21649: [SPARK-23648][R][SQL]Adds more types for hint in SparkR

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

    https://github.com/apache/spark/pull/21649
  
    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 pull request #21649: [SPARK-23648][R][SQL]Adds more types for hint in ...

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

    https://github.com/apache/spark/pull/21649#discussion_r198722659
  
    --- Diff: R/pkg/R/DataFrame.R ---
    @@ -3905,6 +3905,18 @@ setMethod("rollup",
                 groupedData(sgd)
               })
     
    +isTypeAllowed <- function(x) {
    +  if (is.character(x)) {
    +    TRUE
    +  } else if (is.list(x)) {
    --- End diff --
    
    how is `list` going to be used? for instance, do we need to recurse into to check the type of items in the list?


---

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


[GitHub] spark pull request #21649: [SPARK-23648][R][SQL]Adds more types for hint in ...

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

    https://github.com/apache/spark/pull/21649#discussion_r199328283
  
    --- Diff: R/pkg/R/DataFrame.R ---
    @@ -3905,6 +3905,16 @@ setMethod("rollup",
                 groupedData(sgd)
               })
     
    +isTypeAllowedForSqlHint <- function(x) {
    +  if (is.character(x) | is.numeric(x)) {
    --- End diff --
    
    nit: very minor, both is.* returns a single element, but with `||` you get shortcut eval if is.character(x) is TRUE



---

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


[GitHub] spark issue #21649: [SPARK-23648][R][SQL]Adds more types for hint in SparkR

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

    https://github.com/apache/spark/pull/21649
  
    **[Test build #96149 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/96149/testReport)** for PR 21649 at commit [`e8d97a0`](https://github.com/apache/spark/commit/e8d97a01ab99404fbfda42499143a8de489a3896).
     * 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 pull request #21649: [SPARK-23648][R][SQL]Adds more types for hint in ...

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

    https://github.com/apache/spark/pull/21649#discussion_r199057309
  
    --- Diff: R/pkg/R/DataFrame.R ---
    @@ -3905,6 +3905,18 @@ setMethod("rollup",
                 groupedData(sgd)
               })
     
    +isTypeAllowed <- function(x) {
    +  if (is.character(x)) {
    +    TRUE
    +  } else if (is.list(x)) {
    --- End diff --
    
    in R list could have a list too, not sure if we should recurse indefinitely
    ```
    > a <- list(list(a = 1, b = 2))
    > a
    [[1]]
    [[1]]$a
    [1] 1
    
    [[1]]$b
    [1] 2
    
    ```


---

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


[GitHub] spark issue #21649: [SPARK-23648][R][SQL]Adds more types for hint in SparkR

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

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


---

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


[GitHub] spark issue #21649: [SPARK-23648][R][SQL]Adds more types for hint in SparkR

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

    https://github.com/apache/spark/pull/21649
  
    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-unified/3022/
    Test PASSed.


---

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