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 2021/05/14 17:49:15 UTC

[GitHub] [spark] sunchao opened a new pull request #32553: [SPARK-35389][SQL] V2 ScalarFunction should support magic method with null arguments

sunchao opened a new pull request #32553:
URL: https://github.com/apache/spark/pull/32553


   <!--
   Thanks for sending a pull request!  Here are some tips for you:
     1. If this is your first time, please read our contributor guidelines: https://spark.apache.org/contributing.html
     2. Ensure you have added or run the appropriate tests for your PR: https://spark.apache.org/developer-tools.html
     3. If the PR is unfinished, add '[WIP]' in your PR title, e.g., '[WIP][SPARK-XXXX] Your PR title ...'.
     4. Be sure to keep the PR description updated to reflect all changes.
     5. Please write your PR title to summarize what this PR proposes.
     6. If possible, provide a concise example to reproduce the issue for a faster review.
     7. If you want to add a new configuration, please read the guideline first for naming configurations in
        'core/src/main/scala/org/apache/spark/internal/config/ConfigEntry.scala'.
     8. If you want to add or modify an error message, please read the guideline first:
        https://spark.apache.org/error-message-guidelines.html
   -->
   
   ### What changes were proposed in this pull request?
   <!--
   Please clarify what changes you are proposing. The purpose of this section is to outline the changes and how this PR fixes the issue. 
   If possible, please consider writing useful notes for better and faster reviews in your PR. See the examples below.
     1. If you refactor some codes with changing classes, showing the class hierarchy will help reviewers.
     2. If you fix some SQL features, you can provide some references of other DBMSes.
     3. If there is design documentation, please add the link.
     4. If there is a discussion in the mailing list, please add the link.
   -->
   
   When creating `Invoke` and `StaticInvoke` for `ScalarFunction`'s magic method, set `propagateNull` to false.
   
   ### Why are the changes needed?
   <!--
   Please clarify why the changes are needed. For instance,
     1. If you propose a new API, clarify the use case for a new API.
     2. If you fix a bug, you can clarify why it is a bug.
   -->
   
   When `propgagateNull` is true (which is the default value), `Invoke` and `StaticInvoke` will return null if any of the argument is null. For scalar function this is incorrect, as we should leave the logic to function implementation instead.
   
   ### Does this PR introduce _any_ user-facing change?
   <!--
   Note that it means *any* user-facing change including all aspects such as the documentation fix.
   If yes, please clarify the previous behavior and the change this PR proposes - provide the console output, description and/or an example to show the behavior difference if possible.
   If possible, please also clarify if this is a user-facing change compared to the released Spark versions or within the unreleased branches such as master.
   If no, write 'No'.
   -->
   
   Yes. Now null arguments shall be properly handled with magic method.
   
   ### How was this patch tested?
   <!--
   If tests were added, say they were added here. Please make sure to add some test cases that check the changes thoroughly including negative and positive cases if possible.
   If it was tested in a way different from regular unit tests, please clarify how you tested step by step, ideally copy and paste-able, so that other reviewers can test and check, and descendants can verify in the future.
   If tests were not added, please describe why they were not added and/or why it was difficult to add.
   -->
   
   Added new tests.


-- 
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


[GitHub] [spark] SparkQA removed a comment on pull request #32553: [SPARK-35389][SQL] V2 ScalarFunction should support magic method with null arguments

Posted by GitBox <gi...@apache.org>.
SparkQA removed a comment on pull request #32553:
URL: https://github.com/apache/spark/pull/32553#issuecomment-841405094


   **[Test build #138564 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/138564/testReport)** for PR 32553 at commit [`8c4dfb8`](https://github.com/apache/spark/commit/8c4dfb89a74331586ff849783523c56934399b9b).


-- 
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


[GitHub] [spark] cloud-fan commented on a change in pull request #32553: [SPARK-35389][SQL] V2 ScalarFunction should support magic method with null arguments

Posted by GitBox <gi...@apache.org>.
cloud-fan commented on a change in pull request #32553:
URL: https://github.com/apache/spark/pull/32553#discussion_r634039384



##########
File path: sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/objects/objects.scala
##########
@@ -50,7 +50,14 @@ trait InvokeLike extends Expression with NonSQLExpression {
 
   def propagateNull: Boolean
 
-  protected lazy val needNullCheck: Boolean = propagateNull && arguments.exists(_.nullable)
+  def propagateNullForPrimitive: Boolean

Review comment:
       yea, I agree. If users want to handle null by themselves, they should use boxed primitive types as the UDF parameter type.




-- 
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


[GitHub] [spark] SparkQA commented on pull request #32553: [SPARK-35389][SQL] V2 ScalarFunction should support magic method with null arguments

Posted by GitBox <gi...@apache.org>.
SparkQA commented on pull request #32553:
URL: https://github.com/apache/spark/pull/32553#issuecomment-842718403


   Kubernetes integration test unable to build dist.
   
   exiting with code: 1
   URL: https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder-K8s/43170/
   


-- 
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


[GitHub] [spark] AmplabJenkins commented on pull request #32553: [SPARK-35389][SQL] V2 ScalarFunction should support magic method with null arguments

Posted by GitBox <gi...@apache.org>.
AmplabJenkins commented on pull request #32553:
URL: https://github.com/apache/spark/pull/32553#issuecomment-841457622


   
   Refer to this link for build results (access rights to CI server needed): 
   https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder-K8s/43085/
   


-- 
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


[GitHub] [spark] AmplabJenkins removed a comment on pull request #32553: [SPARK-35389][SQL] V2 ScalarFunction should support magic method with null arguments

Posted by GitBox <gi...@apache.org>.
AmplabJenkins removed a comment on pull request #32553:
URL: https://github.com/apache/spark/pull/32553#issuecomment-842802193


   
   Refer to this link for build results (access rights to CI server needed): 
   https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder-K8s/43177/
   


-- 
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


[GitHub] [spark] SparkQA commented on pull request #32553: [SPARK-35389][SQL] V2 ScalarFunction should support magic method with null arguments

Posted by GitBox <gi...@apache.org>.
SparkQA commented on pull request #32553:
URL: https://github.com/apache/spark/pull/32553#issuecomment-841405094


   **[Test build #138564 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/138564/testReport)** for PR 32553 at commit [`8c4dfb8`](https://github.com/apache/spark/commit/8c4dfb89a74331586ff849783523c56934399b9b).


-- 
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


[GitHub] [spark] SparkQA commented on pull request #32553: [SPARK-35389][SQL] V2 ScalarFunction should support magic method with null arguments

Posted by GitBox <gi...@apache.org>.
SparkQA commented on pull request #32553:
URL: https://github.com/apache/spark/pull/32553#issuecomment-842716508


   **[Test build #138650 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/138650/testReport)** for PR 32553 at commit [`6a87a27`](https://github.com/apache/spark/commit/6a87a27d7f1b8c9f40f50a2e256831d96f1b3764).


-- 
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


[GitHub] [spark] SparkQA commented on pull request #32553: [SPARK-35389][SQL] V2 ScalarFunction should support magic method with null arguments

Posted by GitBox <gi...@apache.org>.
SparkQA commented on pull request #32553:
URL: https://github.com/apache/spark/pull/32553#issuecomment-842778626


   Kubernetes integration test starting
   URL: https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder-K8s/43177/
   


-- 
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


[GitHub] [spark] AmplabJenkins commented on pull request #32553: [SPARK-35389][SQL] V2 ScalarFunction should support magic method with null arguments

Posted by GitBox <gi...@apache.org>.
AmplabJenkins commented on pull request #32553:
URL: https://github.com/apache/spark/pull/32553#issuecomment-842719142


   
   Refer to this link for build results (access rights to CI server needed): 
   https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/138650/
   


-- 
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


[GitHub] [spark] SparkQA commented on pull request #32553: [SPARK-35389][SQL] V2 ScalarFunction should support magic method with null arguments

Posted by GitBox <gi...@apache.org>.
SparkQA commented on pull request #32553:
URL: https://github.com/apache/spark/pull/32553#issuecomment-841532455


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


-- 
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


[GitHub] [spark] AmplabJenkins commented on pull request #32553: [SPARK-35389][SQL] V2 ScalarFunction should support magic method with null arguments

Posted by GitBox <gi...@apache.org>.
AmplabJenkins commented on pull request #32553:
URL: https://github.com/apache/spark/pull/32553#issuecomment-841533703


   
   Refer to this link for build results (access rights to CI server needed): 
   https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/138564/
   


-- 
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


[GitHub] [spark] AmplabJenkins commented on pull request #32553: [SPARK-35389][SQL] V2 ScalarFunction should support magic method with null arguments

Posted by GitBox <gi...@apache.org>.
AmplabJenkins commented on pull request #32553:
URL: https://github.com/apache/spark/pull/32553#issuecomment-842740762


   
   Refer to this link for build results (access rights to CI server needed): 
   https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder-K8s/43171/
   


-- 
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


[GitHub] [spark] AmplabJenkins removed a comment on pull request #32553: [SPARK-35389][SQL] V2 ScalarFunction should support magic method with null arguments

Posted by GitBox <gi...@apache.org>.
AmplabJenkins removed a comment on pull request #32553:
URL: https://github.com/apache/spark/pull/32553#issuecomment-842859770


   
   Refer to this link for build results (access rights to CI server needed): 
   https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/138655/
   


-- 
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


[GitHub] [spark] AmplabJenkins commented on pull request #32553: [SPARK-35389][SQL] V2 ScalarFunction should support magic method with null arguments

Posted by GitBox <gi...@apache.org>.
AmplabJenkins commented on pull request #32553:
URL: https://github.com/apache/spark/pull/32553#issuecomment-842979559


   
   Refer to this link for build results (access rights to CI server needed): 
   https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder-K8s/43187/
   


-- 
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


[GitHub] [spark] SparkQA commented on pull request #32553: [SPARK-35389][SQL] V2 ScalarFunction should support magic method with null arguments

Posted by GitBox <gi...@apache.org>.
SparkQA commented on pull request #32553:
URL: https://github.com/apache/spark/pull/32553#issuecomment-842738865


   **[Test build #138651 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/138651/testReport)** for PR 32553 at commit [`136867f`](https://github.com/apache/spark/commit/136867f7c7db23666066d9730c6acfbc996c635f).


-- 
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


[GitHub] [spark] SparkQA removed a comment on pull request #32553: [SPARK-35389][SQL] V2 ScalarFunction should support magic method with null arguments

Posted by GitBox <gi...@apache.org>.
SparkQA removed a comment on pull request #32553:
URL: https://github.com/apache/spark/pull/32553#issuecomment-842716508


   **[Test build #138650 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/138650/testReport)** for PR 32553 at commit [`6a87a27`](https://github.com/apache/spark/commit/6a87a27d7f1b8c9f40f50a2e256831d96f1b3764).


-- 
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


[GitHub] [spark] SparkQA commented on pull request #32553: [SPARK-35389][SQL] V2 ScalarFunction should support magic method with null arguments

Posted by GitBox <gi...@apache.org>.
SparkQA commented on pull request #32553:
URL: https://github.com/apache/spark/pull/32553#issuecomment-842740756


   Kubernetes integration test unable to build dist.
   
   exiting with code: 1
   URL: https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder-K8s/43171/
   


-- 
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


[GitHub] [spark] SparkQA commented on pull request #32553: [SPARK-35389][SQL] V2 ScalarFunction should support magic method with null arguments

Posted by GitBox <gi...@apache.org>.
SparkQA commented on pull request #32553:
URL: https://github.com/apache/spark/pull/32553#issuecomment-842940337


   Kubernetes integration test starting
   URL: https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder-K8s/43187/
   


-- 
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


[GitHub] [spark] SparkQA commented on pull request #32553: [SPARK-35389][SQL] V2 ScalarFunction should support magic method with null arguments

Posted by GitBox <gi...@apache.org>.
SparkQA commented on pull request #32553:
URL: https://github.com/apache/spark/pull/32553#issuecomment-842897082


   **[Test build #138666 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/138666/testReport)** for PR 32553 at commit [`fb0d959`](https://github.com/apache/spark/commit/fb0d959fa2ba7ced2370840e3bb9fd53321b921b).


-- 
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


[GitHub] [spark] sunchao commented on pull request #32553: [SPARK-35389][SQL] V2 ScalarFunction should support magic method with null arguments

Posted by GitBox <gi...@apache.org>.
sunchao commented on pull request #32553:
URL: https://github.com/apache/spark/pull/32553#issuecomment-843247054


   Thanks @cloud-fan and @viirya for the review!


-- 
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


[GitHub] [spark] AmplabJenkins removed a comment on pull request #32553: [SPARK-35389][SQL] V2 ScalarFunction should support magic method with null arguments

Posted by GitBox <gi...@apache.org>.
AmplabJenkins removed a comment on pull request #32553:
URL: https://github.com/apache/spark/pull/32553#issuecomment-841533703


   
   Refer to this link for build results (access rights to CI server needed): 
   https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/138564/
   


-- 
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


[GitHub] [spark] SparkQA commented on pull request #32553: [SPARK-35389][SQL] V2 ScalarFunction should support magic method with null arguments

Posted by GitBox <gi...@apache.org>.
SparkQA commented on pull request #32553:
URL: https://github.com/apache/spark/pull/32553#issuecomment-842790642


   Kubernetes integration test status success
   URL: https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder-K8s/43177/
   


-- 
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


[GitHub] [spark] AmplabJenkins commented on pull request #32553: [SPARK-35389][SQL] V2 ScalarFunction should support magic method with null arguments

Posted by GitBox <gi...@apache.org>.
AmplabJenkins commented on pull request #32553:
URL: https://github.com/apache/spark/pull/32553#issuecomment-843099871


   
   Refer to this link for build results (access rights to CI server needed): 
   https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/138666/
   


-- 
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


[GitHub] [spark] AmplabJenkins removed a comment on pull request #32553: [SPARK-35389][SQL] V2 ScalarFunction should support magic method with null arguments

Posted by GitBox <gi...@apache.org>.
AmplabJenkins removed a comment on pull request #32553:
URL: https://github.com/apache/spark/pull/32553#issuecomment-842979559


   
   Refer to this link for build results (access rights to CI server needed): 
   https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder-K8s/43187/
   


-- 
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


[GitHub] [spark] viirya commented on a change in pull request #32553: [SPARK-35389][SQL] V2 ScalarFunction should support magic method with null arguments

Posted by GitBox <gi...@apache.org>.
viirya commented on a change in pull request #32553:
URL: https://github.com/apache/spark/pull/32553#discussion_r634081562



##########
File path: sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/objects/objects.scala
##########
@@ -50,7 +50,10 @@ trait InvokeLike extends Expression with NonSQLExpression {
 
   def propagateNull: Boolean
 
-  protected lazy val needNullCheck: Boolean = propagateNull && arguments.exists(_.nullable)
+  protected lazy val needNullCheck: Boolean = needNullCheckForIndex.contains(true)
+  protected lazy val needNullCheckForIndex: Array[Boolean] =
+    arguments.map(a => a.nullable && (propagateNull ||

Review comment:
       Oh, nvm. I saw you updated it below.




-- 
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


[GitHub] [spark] viirya commented on a change in pull request #32553: [SPARK-35389][SQL] V2 ScalarFunction should support magic method with null arguments

Posted by GitBox <gi...@apache.org>.
viirya commented on a change in pull request #32553:
URL: https://github.com/apache/spark/pull/32553#discussion_r634078254



##########
File path: sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/Analyzer.scala
##########
@@ -2204,11 +2204,12 @@ class Analyzer(override val catalogManager: CatalogManager)
         findMethod(scalarFunc, MAGIC_METHOD_NAME, argClasses) match {
           case Some(m) if Modifier.isStatic(m.getModifiers) =>
             StaticInvoke(scalarFunc.getClass, scalarFunc.resultType(),
-              MAGIC_METHOD_NAME, arguments, returnNullable = scalarFunc.isResultNullable)
+              MAGIC_METHOD_NAME, arguments, propagateNull = false,

Review comment:
       So I think we need `propagateNull` as true, instead of false?




-- 
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


[GitHub] [spark] AmplabJenkins commented on pull request #32553: [SPARK-35389][SQL] V2 ScalarFunction should support magic method with null arguments

Posted by GitBox <gi...@apache.org>.
AmplabJenkins commented on pull request #32553:
URL: https://github.com/apache/spark/pull/32553#issuecomment-842718470


   
   Refer to this link for build results (access rights to CI server needed): 
   https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder-K8s/43170/
   


-- 
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


[GitHub] [spark] SparkQA commented on pull request #32553: [SPARK-35389][SQL] V2 ScalarFunction should support magic method with null arguments

Posted by GitBox <gi...@apache.org>.
SparkQA commented on pull request #32553:
URL: https://github.com/apache/spark/pull/32553#issuecomment-842699649


   **[Test build #138649 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/138649/testReport)** for PR 32553 at commit [`df6eec2`](https://github.com/apache/spark/commit/df6eec29aa4b2482d1ddb13ac8c6cf31e02a2f41).
    * This patch **fails to build**.
    * This patch merges cleanly.
    * This patch adds no public classes.


-- 
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


[GitHub] [spark] cloud-fan closed pull request #32553: [SPARK-35389][SQL] V2 ScalarFunction should support magic method with null arguments

Posted by GitBox <gi...@apache.org>.
cloud-fan closed pull request #32553:
URL: https://github.com/apache/spark/pull/32553


   


-- 
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


[GitHub] [spark] SparkQA commented on pull request #32553: [SPARK-35389][SQL] V2 ScalarFunction should support magic method with null arguments

Posted by GitBox <gi...@apache.org>.
SparkQA commented on pull request #32553:
URL: https://github.com/apache/spark/pull/32553#issuecomment-842697097


   **[Test build #138649 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/138649/testReport)** for PR 32553 at commit [`df6eec2`](https://github.com/apache/spark/commit/df6eec29aa4b2482d1ddb13ac8c6cf31e02a2f41).


-- 
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


[GitHub] [spark] AmplabJenkins commented on pull request #32553: [SPARK-35389][SQL] V2 ScalarFunction should support magic method with null arguments

Posted by GitBox <gi...@apache.org>.
AmplabJenkins commented on pull request #32553:
URL: https://github.com/apache/spark/pull/32553#issuecomment-842802193


   
   Refer to this link for build results (access rights to CI server needed): 
   https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder-K8s/43177/
   


-- 
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


[GitHub] [spark] AmplabJenkins commented on pull request #32553: [SPARK-35389][SQL] V2 ScalarFunction should support magic method with null arguments

Posted by GitBox <gi...@apache.org>.
AmplabJenkins commented on pull request #32553:
URL: https://github.com/apache/spark/pull/32553#issuecomment-842859770


   
   Refer to this link for build results (access rights to CI server needed): 
   https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/138655/
   


-- 
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


[GitHub] [spark] SparkQA commented on pull request #32553: [SPARK-35389][SQL] V2 ScalarFunction should support magic method with null arguments

Posted by GitBox <gi...@apache.org>.
SparkQA commented on pull request #32553:
URL: https://github.com/apache/spark/pull/32553#issuecomment-842741402


   **[Test build #138651 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/138651/testReport)** for PR 32553 at commit [`136867f`](https://github.com/apache/spark/commit/136867f7c7db23666066d9730c6acfbc996c635f).
    * This patch **fails to build**.
    * This patch merges cleanly.
    * This patch adds no public classes.


-- 
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


[GitHub] [spark] cloud-fan commented on a change in pull request #32553: [SPARK-35389][SQL] V2 ScalarFunction should support magic method with null arguments

Posted by GitBox <gi...@apache.org>.
cloud-fan commented on a change in pull request #32553:
URL: https://github.com/apache/spark/pull/32553#discussion_r633782896



##########
File path: sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/Analyzer.scala
##########
@@ -2204,11 +2204,12 @@ class Analyzer(override val catalogManager: CatalogManager)
         findMethod(scalarFunc, MAGIC_METHOD_NAME, argClasses) match {
           case Some(m) if Modifier.isStatic(m.getModifiers) =>
             StaticInvoke(scalarFunc.getClass, scalarFunc.resultType(),
-              MAGIC_METHOD_NAME, arguments, returnNullable = scalarFunc.isResultNullable)
+              MAGIC_METHOD_NAME, arguments, propagateNull = false,

Review comment:
       How can users handle nullable int values if the UDF is something like `isPositive(int i)` which can't accept null argument?




-- 
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


[GitHub] [spark] AmplabJenkins removed a comment on pull request #32553: [SPARK-35389][SQL] V2 ScalarFunction should support magic method with null arguments

Posted by GitBox <gi...@apache.org>.
AmplabJenkins removed a comment on pull request #32553:
URL: https://github.com/apache/spark/pull/32553#issuecomment-842715109






-- 
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


[GitHub] [spark] SparkQA removed a comment on pull request #32553: [SPARK-35389][SQL] V2 ScalarFunction should support magic method with null arguments

Posted by GitBox <gi...@apache.org>.
SparkQA removed a comment on pull request #32553:
URL: https://github.com/apache/spark/pull/32553#issuecomment-842744214


   **[Test build #138655 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/138655/testReport)** for PR 32553 at commit [`94fd2d0`](https://github.com/apache/spark/commit/94fd2d094866ddf4e28bffaa5c8c383008a9a0d9).


-- 
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


[GitHub] [spark] SparkQA removed a comment on pull request #32553: [SPARK-35389][SQL] V2 ScalarFunction should support magic method with null arguments

Posted by GitBox <gi...@apache.org>.
SparkQA removed a comment on pull request #32553:
URL: https://github.com/apache/spark/pull/32553#issuecomment-842738865


   **[Test build #138651 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/138651/testReport)** for PR 32553 at commit [`136867f`](https://github.com/apache/spark/commit/136867f7c7db23666066d9730c6acfbc996c635f).


-- 
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


[GitHub] [spark] SparkQA commented on pull request #32553: [SPARK-35389][SQL] V2 ScalarFunction should support magic method with null arguments

Posted by GitBox <gi...@apache.org>.
SparkQA commented on pull request #32553:
URL: https://github.com/apache/spark/pull/32553#issuecomment-842698831


   Kubernetes integration test unable to build dist.
   
   exiting with code: 1
   URL: https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder-K8s/43169/
   


-- 
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


[GitHub] [spark] SparkQA commented on pull request #32553: [SPARK-35389][SQL] V2 ScalarFunction should support magic method with null arguments

Posted by GitBox <gi...@apache.org>.
SparkQA commented on pull request #32553:
URL: https://github.com/apache/spark/pull/32553#issuecomment-842744214


   **[Test build #138655 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/138655/testReport)** for PR 32553 at commit [`94fd2d0`](https://github.com/apache/spark/commit/94fd2d094866ddf4e28bffaa5c8c383008a9a0d9).


-- 
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


[GitHub] [spark] sunchao commented on a change in pull request #32553: [SPARK-35389][SQL] V2 ScalarFunction should support magic method with null arguments

Posted by GitBox <gi...@apache.org>.
sunchao commented on a change in pull request #32553:
URL: https://github.com/apache/spark/pull/32553#discussion_r633752218



##########
File path: sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/Analyzer.scala
##########
@@ -2204,11 +2204,12 @@ class Analyzer(override val catalogManager: CatalogManager)
         findMethod(scalarFunc, MAGIC_METHOD_NAME, argClasses) match {
           case Some(m) if Modifier.isStatic(m.getModifiers) =>
             StaticInvoke(scalarFunc.getClass, scalarFunc.resultType(),
-              MAGIC_METHOD_NAME, arguments, returnNullable = scalarFunc.isResultNullable)
+              MAGIC_METHOD_NAME, arguments, propagateNull = false,

Review comment:
       I think it shouldn't matter. Here we're making sure that the magic method will always be invoked **regardless** of null-ness of the arguments. 
   
   For primitive types this has less significant meaning because even if `progagateNull` is true, `needNullCheck`
   ```
     protected lazy val needNullCheck: Boolean = propagateNull && arguments.exists(_.nullable)
   ```
   in `InvokeLike` also considers null-ness of arguments.




-- 
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


[GitHub] [spark] SparkQA commented on pull request #32553: [SPARK-35389][SQL] V2 ScalarFunction should support magic method with null arguments

Posted by GitBox <gi...@apache.org>.
SparkQA commented on pull request #32553:
URL: https://github.com/apache/spark/pull/32553#issuecomment-842719117


   **[Test build #138650 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/138650/testReport)** for PR 32553 at commit [`6a87a27`](https://github.com/apache/spark/commit/6a87a27d7f1b8c9f40f50a2e256831d96f1b3764).
    * This patch **fails to build**.
    * This patch merges cleanly.
    * This patch adds no public classes.


-- 
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


[GitHub] [spark] viirya commented on a change in pull request #32553: [SPARK-35389][SQL] V2 ScalarFunction should support magic method with null arguments

Posted by GitBox <gi...@apache.org>.
viirya commented on a change in pull request #32553:
URL: https://github.com/apache/spark/pull/32553#discussion_r634115209



##########
File path: sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/Analyzer.scala
##########
@@ -2204,11 +2204,12 @@ class Analyzer(override val catalogManager: CatalogManager)
         findMethod(scalarFunc, MAGIC_METHOD_NAME, argClasses) match {
           case Some(m) if Modifier.isStatic(m.getModifiers) =>
             StaticInvoke(scalarFunc.getClass, scalarFunc.resultType(),
-              MAGIC_METHOD_NAME, arguments, returnNullable = scalarFunc.isResultNullable)
+              MAGIC_METHOD_NAME, arguments, propagateNull = false,

Review comment:
       Got it. Thanks.




-- 
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


[GitHub] [spark] viirya commented on a change in pull request #32553: [SPARK-35389][SQL] V2 ScalarFunction should support magic method with null arguments

Posted by GitBox <gi...@apache.org>.
viirya commented on a change in pull request #32553:
URL: https://github.com/apache/spark/pull/32553#discussion_r634081309



##########
File path: sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/objects/objects.scala
##########
@@ -50,7 +50,10 @@ trait InvokeLike extends Expression with NonSQLExpression {
 
   def propagateNull: Boolean
 
-  protected lazy val needNullCheck: Boolean = propagateNull && arguments.exists(_.nullable)
+  protected lazy val needNullCheck: Boolean = needNullCheckForIndex.contains(true)
+  protected lazy val needNullCheckForIndex: Array[Boolean] =
+    arguments.map(a => a.nullable && (propagateNull ||

Review comment:
       For this change, I think the definition of `propagateNull` is somehow different now. Previously if `propagateNull` is true, null will be propagated, but now it also depends on if the argument is primitive type. It is better to update `propagateNull` param doc.




-- 
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


[GitHub] [spark] cloud-fan commented on pull request #32553: [SPARK-35389][SQL] V2 ScalarFunction should support magic method with null arguments

Posted by GitBox <gi...@apache.org>.
cloud-fan commented on pull request #32553:
URL: https://github.com/apache/spark/pull/32553#issuecomment-842980341


   thanks, merging to master!


-- 
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


[GitHub] [spark] AmplabJenkins removed a comment on pull request #32553: [SPARK-35389][SQL] V2 ScalarFunction should support magic method with null arguments

Posted by GitBox <gi...@apache.org>.
AmplabJenkins removed a comment on pull request #32553:
URL: https://github.com/apache/spark/pull/32553#issuecomment-843099871


   
   Refer to this link for build results (access rights to CI server needed): 
   https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/138666/
   


-- 
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


[GitHub] [spark] cloud-fan commented on a change in pull request #32553: [SPARK-35389][SQL] V2 ScalarFunction should support magic method with null arguments

Posted by GitBox <gi...@apache.org>.
cloud-fan commented on a change in pull request #32553:
URL: https://github.com/apache/spark/pull/32553#discussion_r633603801



##########
File path: sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/Analyzer.scala
##########
@@ -2204,11 +2204,12 @@ class Analyzer(override val catalogManager: CatalogManager)
         findMethod(scalarFunc, MAGIC_METHOD_NAME, argClasses) match {
           case Some(m) if Modifier.isStatic(m.getModifiers) =>
             StaticInvoke(scalarFunc.getClass, scalarFunc.resultType(),
-              MAGIC_METHOD_NAME, arguments, returnNullable = scalarFunc.isResultNullable)
+              MAGIC_METHOD_NAME, arguments, propagateNull = false,

Review comment:
       how about primitive type parameters?




-- 
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


[GitHub] [spark] sunchao commented on a change in pull request #32553: [SPARK-35389][SQL] V2 ScalarFunction should support magic method with null arguments

Posted by GitBox <gi...@apache.org>.
sunchao commented on a change in pull request #32553:
URL: https://github.com/apache/spark/pull/32553#discussion_r634088872



##########
File path: sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/Analyzer.scala
##########
@@ -2204,11 +2204,12 @@ class Analyzer(override val catalogManager: CatalogManager)
         findMethod(scalarFunc, MAGIC_METHOD_NAME, argClasses) match {
           case Some(m) if Modifier.isStatic(m.getModifiers) =>
             StaticInvoke(scalarFunc.getClass, scalarFunc.resultType(),
-              MAGIC_METHOD_NAME, arguments, returnNullable = scalarFunc.isResultNullable)
+              MAGIC_METHOD_NAME, arguments, propagateNull = false,

Review comment:
       If `propagateNull` is true, we'd return null directly even if input arguments are of non-primitive type, which is not what we want.




-- 
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


[GitHub] [spark] sunchao commented on a change in pull request #32553: [SPARK-35389][SQL] V2 ScalarFunction should support magic method with null arguments

Posted by GitBox <gi...@apache.org>.
sunchao commented on a change in pull request #32553:
URL: https://github.com/apache/spark/pull/32553#discussion_r634030313



##########
File path: sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/objects/objects.scala
##########
@@ -50,7 +50,14 @@ trait InvokeLike extends Expression with NonSQLExpression {
 
   def propagateNull: Boolean
 
-  protected lazy val needNullCheck: Boolean = propagateNull && arguments.exists(_.nullable)
+  def propagateNullForPrimitive: Boolean

Review comment:
       OK. Let me remove the flag then, and add an extra comment to `propagateNull`.
   
   One issue with this approach is that it only applies to the magic method path, while for `produceResult` users will need to handle the null primitive values explicitly. I think we'll need to document this more carefully, otherwise it could cause confusion.




-- 
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


[GitHub] [spark] sunchao commented on a change in pull request #32553: [SPARK-35389][SQL] V2 ScalarFunction should support magic method with null arguments

Posted by GitBox <gi...@apache.org>.
sunchao commented on a change in pull request #32553:
URL: https://github.com/apache/spark/pull/32553#discussion_r633803543



##########
File path: sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/Analyzer.scala
##########
@@ -2204,11 +2204,12 @@ class Analyzer(override val catalogManager: CatalogManager)
         findMethod(scalarFunc, MAGIC_METHOD_NAME, argClasses) match {
           case Some(m) if Modifier.isStatic(m.getModifiers) =>
             StaticInvoke(scalarFunc.getClass, scalarFunc.resultType(),
-              MAGIC_METHOD_NAME, arguments, returnNullable = scalarFunc.isResultNullable)
+              MAGIC_METHOD_NAME, arguments, propagateNull = false,

Review comment:
       Ah I see what you mean, thanks. Seems we should allow users to define magic method with boxed primitive types for this case? We could also follow the behavior of [ScalaUDF](https://github.com/apache/spark/blob/master/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/ScalaUDF.scala#L32) and returns null if any of the primitive type parameter is nullable and the input is null, however currently `InvokeLike` cannot handle the case where a subset of the input types are of primitive nullable type.




-- 
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


[GitHub] [spark] cloud-fan commented on a change in pull request #32553: [SPARK-35389][SQL] V2 ScalarFunction should support magic method with null arguments

Posted by GitBox <gi...@apache.org>.
cloud-fan commented on a change in pull request #32553:
URL: https://github.com/apache/spark/pull/32553#discussion_r633999421



##########
File path: sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/objects/objects.scala
##########
@@ -50,7 +50,14 @@ trait InvokeLike extends Expression with NonSQLExpression {
 
   def propagateNull: Boolean
 
-  protected lazy val needNullCheck: Boolean = propagateNull && arguments.exists(_.nullable)
+  def propagateNullForPrimitive: Boolean

Review comment:
       This reminds me of the rule `HandleNullInputsForUDF`.
   
   For primitive inputs, I don't think we have a choice and we must propagate null (`isPositive(int i)` can't handle null values). Can we detect it automatically instead of adding a new boolean flag?




-- 
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


[GitHub] [spark] SparkQA removed a comment on pull request #32553: [SPARK-35389][SQL] V2 ScalarFunction should support magic method with null arguments

Posted by GitBox <gi...@apache.org>.
SparkQA removed a comment on pull request #32553:
URL: https://github.com/apache/spark/pull/32553#issuecomment-842697097


   **[Test build #138649 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/138649/testReport)** for PR 32553 at commit [`df6eec2`](https://github.com/apache/spark/commit/df6eec29aa4b2482d1ddb13ac8c6cf31e02a2f41).


-- 
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


[GitHub] [spark] AmplabJenkins commented on pull request #32553: [SPARK-35389][SQL] V2 ScalarFunction should support magic method with null arguments

Posted by GitBox <gi...@apache.org>.
AmplabJenkins commented on pull request #32553:
URL: https://github.com/apache/spark/pull/32553#issuecomment-842715111






-- 
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


[GitHub] [spark] SparkQA commented on pull request #32553: [SPARK-35389][SQL] V2 ScalarFunction should support magic method with null arguments

Posted by GitBox <gi...@apache.org>.
SparkQA commented on pull request #32553:
URL: https://github.com/apache/spark/pull/32553#issuecomment-842848579


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


-- 
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


[GitHub] [spark] cloud-fan commented on a change in pull request #32553: [SPARK-35389][SQL] V2 ScalarFunction should support magic method with null arguments

Posted by GitBox <gi...@apache.org>.
cloud-fan commented on a change in pull request #32553:
URL: https://github.com/apache/spark/pull/32553#discussion_r633603801



##########
File path: sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/Analyzer.scala
##########
@@ -2204,11 +2204,12 @@ class Analyzer(override val catalogManager: CatalogManager)
         findMethod(scalarFunc, MAGIC_METHOD_NAME, argClasses) match {
           case Some(m) if Modifier.isStatic(m.getModifiers) =>
             StaticInvoke(scalarFunc.getClass, scalarFunc.resultType(),
-              MAGIC_METHOD_NAME, arguments, returnNullable = scalarFunc.isResultNullable)
+              MAGIC_METHOD_NAME, arguments, propagateNull = false,

Review comment:
       how about primitive type parameters?




-- 
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


[GitHub] [spark] AmplabJenkins removed a comment on pull request #32553: [SPARK-35389][SQL] V2 ScalarFunction should support magic method with null arguments

Posted by GitBox <gi...@apache.org>.
AmplabJenkins removed a comment on pull request #32553:
URL: https://github.com/apache/spark/pull/32553#issuecomment-842741422


   
   Refer to this link for build results (access rights to CI server needed): 
   https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/138651/
   


-- 
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


[GitHub] [spark] dongjoon-hyun commented on pull request #32553: [SPARK-35389][SQL] V2 ScalarFunction should support magic method with null arguments

Posted by GitBox <gi...@apache.org>.
dongjoon-hyun commented on pull request #32553:
URL: https://github.com/apache/spark/pull/32553#issuecomment-841502749


   cc @cloud-fan 


-- 
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


[GitHub] [spark] AmplabJenkins commented on pull request #32553: [SPARK-35389][SQL] V2 ScalarFunction should support magic method with null arguments

Posted by GitBox <gi...@apache.org>.
AmplabJenkins commented on pull request #32553:
URL: https://github.com/apache/spark/pull/32553#issuecomment-842741422


   
   Refer to this link for build results (access rights to CI server needed): 
   https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/138651/
   


-- 
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


[GitHub] [spark] AmplabJenkins removed a comment on pull request #32553: [SPARK-35389][SQL] V2 ScalarFunction should support magic method with null arguments

Posted by GitBox <gi...@apache.org>.
AmplabJenkins removed a comment on pull request #32553:
URL: https://github.com/apache/spark/pull/32553#issuecomment-842718470


   
   Refer to this link for build results (access rights to CI server needed): 
   https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder-K8s/43170/
   


-- 
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


[GitHub] [spark] SparkQA commented on pull request #32553: [SPARK-35389][SQL] V2 ScalarFunction should support magic method with null arguments

Posted by GitBox <gi...@apache.org>.
SparkQA commented on pull request #32553:
URL: https://github.com/apache/spark/pull/32553#issuecomment-842967671


   Kubernetes integration test status success
   URL: https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder-K8s/43187/
   


-- 
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


[GitHub] [spark] AmplabJenkins removed a comment on pull request #32553: [SPARK-35389][SQL] V2 ScalarFunction should support magic method with null arguments

Posted by GitBox <gi...@apache.org>.
AmplabJenkins removed a comment on pull request #32553:
URL: https://github.com/apache/spark/pull/32553#issuecomment-842719142


   
   Refer to this link for build results (access rights to CI server needed): 
   https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/138650/
   


-- 
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


[GitHub] [spark] AmplabJenkins removed a comment on pull request #32553: [SPARK-35389][SQL] V2 ScalarFunction should support magic method with null arguments

Posted by GitBox <gi...@apache.org>.
AmplabJenkins removed a comment on pull request #32553:
URL: https://github.com/apache/spark/pull/32553#issuecomment-842740762


   
   Refer to this link for build results (access rights to CI server needed): 
   https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder-K8s/43171/
   


-- 
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


[GitHub] [spark] AmplabJenkins removed a comment on pull request #32553: [SPARK-35389][SQL] V2 ScalarFunction should support magic method with null arguments

Posted by GitBox <gi...@apache.org>.
AmplabJenkins removed a comment on pull request #32553:
URL: https://github.com/apache/spark/pull/32553#issuecomment-841457622


   
   Refer to this link for build results (access rights to CI server needed): 
   https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder-K8s/43085/
   


-- 
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


[GitHub] [spark] SparkQA commented on pull request #32553: [SPARK-35389][SQL] V2 ScalarFunction should support magic method with null arguments

Posted by GitBox <gi...@apache.org>.
SparkQA commented on pull request #32553:
URL: https://github.com/apache/spark/pull/32553#issuecomment-841456720






-- 
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