You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by GitBox <gi...@apache.org> on 2020/12/19 11:58:01 UTC

[GitHub] [spark] wangyum opened a new pull request #30853: [SPARK-33848][SQL] Push the cast into (if / case) branches

wangyum opened a new pull request #30853:
URL: https://github.com/apache/spark/pull/30853


   <!--
   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'.
   -->
   
   ### 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.
   -->
   
   
   ### 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.
   -->
   
   
   ### 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'.
   -->
   
   
   ### 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.
   -->
   


----------------------------------------------------------------
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] maropu commented on a change in pull request #30853: [SPARK-33848][SQL] Push the cast into (if / case) branches

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



##########
File path: sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/optimizer/expressions.scala
##########
@@ -542,6 +542,18 @@ object PushFoldableIntoBranches extends Rule[LogicalPlan] with PredicateHelper {
 
   def apply(plan: LogicalPlan): LogicalPlan = plan transform {
     case q: LogicalPlan => q transformExpressionsUp {
+      case Cast(i @ If(_, trueValue, falseValue), dataType, timeZoneId)

Review comment:
       Only for cast? We cannot push down a arbitrary unary expr (e.g., abs, cos, ...)?




----------------------------------------------------------------
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 #30853: [SPARK-33848][SQL] Push the cast into (if / case) branches

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


   **[Test build #133060 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/133060/testReport)** for PR 30853 at commit [`bbc1e25`](https://github.com/apache/spark/commit/bbc1e253ac941cf6ca9783c1e04eff4ef02f419a).
    * This patch **fails Spark unit 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] SparkQA commented on pull request #30853: [SPARK-33848][SQL] Push the cast into (if / case) branches

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


   **[Test build #133061 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/133061/testReport)** for PR 30853 at commit [`9f39e9f`](https://github.com/apache/spark/commit/9f39e9ff751a9913b85eee43be4415a401b1f3ac).
    * This patch **fails Spark unit 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 #30853: [SPARK-33848][SQL] Push the UnaryExpression into (if / case) branches

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


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


----------------------------------------------------------------
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 #30853: [SPARK-33848][SQL] Push the cast into (if / case) branches

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


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


----------------------------------------------------------------
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 #30853: [SPARK-33848][SQL] Push the cast into (if / case) branches

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


   **[Test build #133087 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/133087/testReport)** for PR 30853 at commit [`426b75d`](https://github.com/apache/spark/commit/426b75d3441f53dd87313a98f788180577b67031).
    * This patch **fails Spark unit 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 removed a comment on pull request #30853: [SPARK-33848][SQL] Push the cast into (if / case) branches

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


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


----------------------------------------------------------------
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 a change in pull request #30853: [SPARK-33848][SQL] Push the UnaryExpression into (if / case) branches

Posted by GitBox <gi...@apache.org>.
dongjoon-hyun commented on a change in pull request #30853:
URL: https://github.com/apache/spark/pull/30853#discussion_r546696104



##########
File path: sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/optimizer/PushFoldableIntoBranchesSuite.scala
##########
@@ -222,4 +222,41 @@ class PushFoldableIntoBranchesSuite
     assertEquivalent(EqualTo(Literal(4), ifExp), FalseLiteral)
     assertEquivalent(EqualTo(Literal(4), caseWhen), FalseLiteral)
   }
+
+  test("Push down cast through If/CaseWhen") {

Review comment:
       Shall we add `SPARK-33848: ` to new test cases?




----------------------------------------------------------------
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 #30853: [SPARK-33848][SQL] Push the cast into (if / case) branches

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


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


----------------------------------------------------------------
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 #30853: [SPARK-33848][SQL] Push the cast into (if / case) branches

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


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


----------------------------------------------------------------
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 #30853: [SPARK-33848][SQL] Push the UnaryExpression into (if / case) branches

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


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


----------------------------------------------------------------
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 #30853: [SPARK-33848][SQL] Push the UnaryExpression into (if / case) branches

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


   **[Test build #133153 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/133153/testReport)** for PR 30853 at commit [`912cdda`](https://github.com/apache/spark/commit/912cdda38b6544cf8d2b19d0a8d7177f9725f21a).


----------------------------------------------------------------
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 #30853: [SPARK-33848][SQL] Push the UnaryExpression into (if / case) branches

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


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


----------------------------------------------------------------
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] maropu commented on a change in pull request #30853: [SPARK-33848][SQL] Push the UnaryExpression into (if / case) branches

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



##########
File path: sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/optimizer/expressions.scala
##########
@@ -542,29 +542,41 @@ object PushFoldableIntoBranches extends Rule[LogicalPlan] with PredicateHelper {
 
   def apply(plan: LogicalPlan): LogicalPlan = plan transform {
     case q: LogicalPlan => q transformExpressionsUp {
+      case u @ UnaryExpression(i @ If(_, trueValue, falseValue))
+          if !u.isInstanceOf[Alias] && atMostOneUnfoldable(Seq(trueValue, falseValue)) =>

Review comment:
       nit: How about this?
   ```
       case q: LogicalPlan => q transformExpressionsUp {
         case a: Alias => a // Skip an alias
         case u @ UnaryExpression(i @ If(_, trueValue, falseValue))
             if atMostOneUnfoldable(Seq(trueValue, falseValue)) => ...
   ```




----------------------------------------------------------------
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 #30853: [SPARK-33848][SQL] Push the cast into (if / case) branches

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


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


----------------------------------------------------------------
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 #30853: [SPARK-33848][SQL] Push the cast into (if / case) branches

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


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


----------------------------------------------------------------
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 #30853: [SPARK-33848][SQL] Push the cast into (if / case) branches

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


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


----------------------------------------------------------------
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 #30853: [SPARK-33848][SQL] Push the cast into (if / case) branches

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


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


----------------------------------------------------------------
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 #30853: [SPARK-33848][SQL] Push the UnaryExpression into (if / case) branches

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


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


----------------------------------------------------------------
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 #30853: [SPARK-33848][SQL] Push the cast into (if / case) branches

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


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


----------------------------------------------------------------
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 #30853: [SPARK-33848][SQL] Push the UnaryExpression into (if / case) branches

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



##########
File path: sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/optimizer/expressions.scala
##########
@@ -542,29 +542,42 @@ object PushFoldableIntoBranches extends Rule[LogicalPlan] with PredicateHelper {
 
   def apply(plan: LogicalPlan): LogicalPlan = plan transform {
     case q: LogicalPlan => q transformExpressionsUp {
+      case a: Alias => a // Skip an alias.

Review comment:
       I'm not sure, but it's safer to start with an allowlist.  We can extend it later.




----------------------------------------------------------------
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 #30853: [SPARK-33848][SQL] Push the cast into (if / case) branches

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


   **[Test build #133091 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/133091/testReport)** for PR 30853 at commit [`480a92b`](https://github.com/apache/spark/commit/480a92bd2421b31f2ea2dd04bf450c8cb26d552f).


----------------------------------------------------------------
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 #30853: [SPARK-33848][SQL] Push the cast into (if / case) branches

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


   **[Test build #133087 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/133087/testReport)** for PR 30853 at commit [`426b75d`](https://github.com/apache/spark/commit/426b75d3441f53dd87313a98f788180577b67031).


----------------------------------------------------------------
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 #30853: [SPARK-33848][SQL] Push the cast into (if / case) branches

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


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


----------------------------------------------------------------
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 #30853: [SPARK-33848][SQL] Push the cast into (if / case) branches

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


   **[Test build #133061 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/133061/testReport)** for PR 30853 at commit [`9f39e9f`](https://github.com/apache/spark/commit/9f39e9ff751a9913b85eee43be4415a401b1f3ac).


----------------------------------------------------------------
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 #30853: [SPARK-33848][SQL] Push the UnaryExpression into (if / case) branches

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


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


----------------------------------------------------------------
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 #30853: [SPARK-33848][SQL] Push the UnaryExpression into (if / case) branches

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


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


----------------------------------------------------------------
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 #30853: [SPARK-33848][SQL] Push the cast into (if / case) branches

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


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


----------------------------------------------------------------
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 #30853: [SPARK-33848][SQL] Push the cast into (if / case) branches

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


   **[Test build #133091 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/133091/testReport)** for PR 30853 at commit [`480a92b`](https://github.com/apache/spark/commit/480a92bd2421b31f2ea2dd04bf450c8cb26d552f).


----------------------------------------------------------------
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 #30853: [SPARK-33848][SQL] Push the cast into (if / case) branches

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


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


----------------------------------------------------------------
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] HyukjinKwon commented on pull request #30853: [SPARK-33848][SQL] Push the UnaryExpression into (if / case) branches

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


   Nice, late LGTM


----------------------------------------------------------------
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 #30853: [SPARK-33848][SQL] Push the cast into (if / case) branches

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


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


----------------------------------------------------------------
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 #30853: [SPARK-33848][SQL] Push the UnaryExpression into (if / case) branches

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



##########
File path: sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/optimizer/expressions.scala
##########
@@ -542,29 +542,42 @@ object PushFoldableIntoBranches extends Rule[LogicalPlan] with PredicateHelper {
 
   def apply(plan: LogicalPlan): LogicalPlan = plan transform {
     case q: LogicalPlan => q transformExpressionsUp {
+      case a: Alias => a // Skip an alias.

Review comment:
       `Alias` is not the only exception, we can't apply this optimization for `Generator` as well, as the logical plan `Generate` requires explicit type `Generator`.
   
   It happened many times that an optimization rule introduces bugs because it uses denylist instead of allowlist. Let's avoid similar mistakes here, and explicitly list what expressions we should support.
   
   An initial list from my mind:
   1. IsNull, IsNotNull
   2. UnaryMathExpression
   3. String2StringExpression
   4. Cast
   5. BinaryComparison
   6. BinaryArithmetic




----------------------------------------------------------------
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] wangyum commented on a change in pull request #30853: [SPARK-33848][SQL] Push the cast into (if / case) branches

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



##########
File path: sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/optimizer/expressions.scala
##########
@@ -542,6 +542,18 @@ object PushFoldableIntoBranches extends Rule[LogicalPlan] with PredicateHelper {
 
   def apply(plan: LogicalPlan): LogicalPlan = plan transform {
     case q: LogicalPlan => q transformExpressionsUp {
+      case Cast(i @ If(_, trueValue, falseValue), dataType, timeZoneId)

Review comment:
       Could we split it to 2 PRs, this is because we can not use `makeCopy` for `Cast` `Expression`:
   ```
   Is otherCopyArgs specified correctly for Cast.
   Exception message: wrong number of arguments
   ctor: public org.apache.spark.sql.catalyst.expressions.Cast(org.apache.spark.sql.catalyst.expressions.Expression,org.apache.spark.sql.types.DataType,scala.Option)?
   types: class org.apache.spark.sql.catalyst.expressions.Literal
   args: 1
              , tree: cast(if ((id#1L = 1)) 1 else 2 as int)
   	at org.apache.spark.sql.catalyst.trees.TreeNode.$anonfun$makeCopy$1(TreeNode.scala:515)
   	at org.apache.spark.sql.catalyst.errors.package$.attachTree(package.scala:52)
   	... 129 more
   ```
   
   Maybe the complete change is like this:
   ```
         case u @ UnaryExpression(i @ If(_, trueValue, falseValue))
             if u.getClass.getConstructors.headOption.forall(_.getParameterCount == 1) &&
               atMostOneUnfoldable(Seq(trueValue, falseValue)) =>
           i.copy(trueValue = u.makeCopy(Array(trueValue)), falseValue = u.makeCopy(Array(falseValue)))
   
         case u @ UnaryExpression(c @ CaseWhen(branches, elseValue))
             if u.getClass.getConstructors.headOption.forall(_.getParameterCount == 1) &&
               atMostOneUnfoldable(branches.map(_._2) ++ elseValue) =>
           c.copy(
             branches.map(e => e.copy(_2 = u.makeCopy(Array(e._2)))),
             elseValue.map(e => u.makeCopy(Array(e))))
   
         case Cast(i @ If(_, trueValue, falseValue), dataType, timeZoneId)
             if atMostOneUnfoldable(Seq(trueValue, falseValue)) =>
           i.copy(
             trueValue = Cast(trueValue, dataType, timeZoneId),
             falseValue = Cast(falseValue, dataType, timeZoneId))
   
         case Cast(c @ CaseWhen(branches, elseValue), dataType, timeZoneId)
             if atMostOneUnfoldable(branches.map(_._2) ++ elseValue) =>
           c.copy(
             branches.map(e => e.copy(_2 = Cast(e._2, dataType, timeZoneId))),
             elseValue.map(e => Cast(e, dataType, timeZoneId)))
   ```




----------------------------------------------------------------
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 #30853: [SPARK-33848][SQL] Push the cast into (if / case) branches

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


   **[Test build #133061 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/133061/testReport)** for PR 30853 at commit [`9f39e9f`](https://github.com/apache/spark/commit/9f39e9ff751a9913b85eee43be4415a401b1f3ac).


----------------------------------------------------------------
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 #30853: [SPARK-33848][SQL] Push the UnaryExpression into (if / case) branches

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


   **[Test build #133153 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/133153/testReport)** for PR 30853 at commit [`912cdda`](https://github.com/apache/spark/commit/912cdda38b6544cf8d2b19d0a8d7177f9725f21a).


----------------------------------------------------------------
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 #30853: [SPARK-33848][SQL] Push the cast into (if / case) branches

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


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


----------------------------------------------------------------
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 #30853: [SPARK-33848][SQL] Push the cast into (if / case) branches

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


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


----------------------------------------------------------------
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] wangyum commented on a change in pull request #30853: [SPARK-33848][SQL] Push the UnaryExpression into (if / case) branches

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



##########
File path: sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/optimizer/expressions.scala
##########
@@ -542,29 +542,42 @@ object PushFoldableIntoBranches extends Rule[LogicalPlan] with PredicateHelper {
 
   def apply(plan: LogicalPlan): LogicalPlan = plan transform {
     case q: LogicalPlan => q transformExpressionsUp {
+      case a: Alias => a // Skip an alias.

Review comment:
       Do you think `BinaryExpression` also has this issue?




----------------------------------------------------------------
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 #30853: [SPARK-33848][SQL] Push the cast into (if / case) branches

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


   **[Test build #133060 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/133060/testReport)** for PR 30853 at commit [`bbc1e25`](https://github.com/apache/spark/commit/bbc1e253ac941cf6ca9783c1e04eff4ef02f419a).


----------------------------------------------------------------
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] maropu commented on a change in pull request #30853: [SPARK-33848][SQL] Push the cast into (if / case) branches

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



##########
File path: sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/optimizer/expressions.scala
##########
@@ -542,6 +542,18 @@ object PushFoldableIntoBranches extends Rule[LogicalPlan] with PredicateHelper {
 
   def apply(plan: LogicalPlan): LogicalPlan = plan transform {
     case q: LogicalPlan => q transformExpressionsUp {
+      case Cast(i @ If(_, trueValue, falseValue), dataType, timeZoneId)

Review comment:
       Only for cast? We cannot push down an arbitrary unary expr (e.g., abs, cos, ...)?




----------------------------------------------------------------
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 #30853: [SPARK-33848][SQL] Push the cast into (if / case) branches

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


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


----------------------------------------------------------------
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 #30853: [SPARK-33848][SQL] Push the cast into (if / case) branches

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


   **[Test build #133075 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/133075/testReport)** for PR 30853 at commit [`426b75d`](https://github.com/apache/spark/commit/426b75d3441f53dd87313a98f788180577b67031).


----------------------------------------------------------------
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 #30853: [SPARK-33848][SQL] Push the cast into (if / case) branches

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






----------------------------------------------------------------
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 #30853: [SPARK-33848][SQL] Push the cast into (if / case) branches

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


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


----------------------------------------------------------------
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 #30853: [SPARK-33848][SQL] Push the cast into (if / case) branches

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


   **[Test build #133075 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/133075/testReport)** for PR 30853 at commit [`426b75d`](https://github.com/apache/spark/commit/426b75d3441f53dd87313a98f788180577b67031).


----------------------------------------------------------------
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 #30853: [SPARK-33848][SQL] Push the UnaryExpression into (if / case) branches

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


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


----------------------------------------------------------------
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 #30853: [SPARK-33848][SQL] Push the UnaryExpression into (if / case) branches

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


   **[Test build #133153 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/133153/testReport)** for PR 30853 at commit [`912cdda`](https://github.com/apache/spark/commit/912cdda38b6544cf8d2b19d0a8d7177f9725f21a).
    * 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] SparkQA commented on pull request #30853: [SPARK-33848][SQL] Push the cast into (if / case) branches

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


   **[Test build #133091 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/133091/testReport)** for PR 30853 at commit [`480a92b`](https://github.com/apache/spark/commit/480a92bd2421b31f2ea2dd04bf450c8cb26d552f).
    * 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] maropu commented on pull request #30853: [SPARK-33848][SQL] Push the UnaryExpression into (if / case) branches

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


   Looks fine if the tests pass.


----------------------------------------------------------------
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 #30853: [SPARK-33848][SQL] Push the cast into (if / case) branches

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


   **[Test build #133060 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/133060/testReport)** for PR 30853 at commit [`bbc1e25`](https://github.com/apache/spark/commit/bbc1e253ac941cf6ca9783c1e04eff4ef02f419a).


----------------------------------------------------------------
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 #30853: [SPARK-33848][SQL] Push the cast into (if / case) branches

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


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


----------------------------------------------------------------
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] wangyum commented on a change in pull request #30853: [SPARK-33848][SQL] Push the UnaryExpression into (if / case) branches

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



##########
File path: sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/optimizer/expressions.scala
##########
@@ -542,29 +542,42 @@ object PushFoldableIntoBranches extends Rule[LogicalPlan] with PredicateHelper {
 
   def apply(plan: LogicalPlan): LogicalPlan = plan transform {
     case q: LogicalPlan => q transformExpressionsUp {
+      case a: Alias => a // Skip an alias.

Review comment:
       https://github.com/apache/spark/pull/30955




----------------------------------------------------------------
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 #30853: [SPARK-33848][SQL] Push the cast into (if / case) branches

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


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


----------------------------------------------------------------
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 #30853: [SPARK-33848][SQL] Push the cast into (if / case) branches

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


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


----------------------------------------------------------------
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 #30853: [SPARK-33848][SQL] Push the cast into (if / case) branches

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


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


----------------------------------------------------------------
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 closed pull request #30853: [SPARK-33848][SQL] Push the UnaryExpression into (if / case) branches

Posted by GitBox <gi...@apache.org>.
dongjoon-hyun closed pull request #30853:
URL: https://github.com/apache/spark/pull/30853


   


----------------------------------------------------------------
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] wangyum commented on pull request #30853: [SPARK-33848][SQL] Push the cast into (if / case) branches

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


   Retest this please.


----------------------------------------------------------------
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 #30853: [SPARK-33848][SQL] Push the cast into (if / case) branches

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


   **[Test build #133075 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/133075/testReport)** for PR 30853 at commit [`426b75d`](https://github.com/apache/spark/commit/426b75d3441f53dd87313a98f788180577b67031).
    * This patch **fails SparkR unit 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] SparkQA commented on pull request #30853: [SPARK-33848][SQL] Push the cast into (if / case) branches

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


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


----------------------------------------------------------------
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 #30853: [SPARK-33848][SQL] Push the cast into (if / case) branches

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


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


----------------------------------------------------------------
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 #30853: [SPARK-33848][SQL] Push the UnaryExpression into (if / case) branches

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


   **[Test build #133159 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/133159/testReport)** for PR 30853 at commit [`a0995d6`](https://github.com/apache/spark/commit/a0995d6404208cc05995ffbb3fd84ac3caf4156f).


----------------------------------------------------------------
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 #30853: [SPARK-33848][SQL] Push the cast into (if / case) branches

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


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


----------------------------------------------------------------
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 #30853: [SPARK-33848][SQL] Push the cast into (if / case) branches

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


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


----------------------------------------------------------------
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 #30853: [SPARK-33848][SQL] Push the UnaryExpression into (if / case) branches

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


   **[Test build #133159 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/133159/testReport)** for PR 30853 at commit [`a0995d6`](https://github.com/apache/spark/commit/a0995d6404208cc05995ffbb3fd84ac3caf4156f).
    * 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 removed a comment on pull request #30853: [SPARK-33848][SQL] Push the cast into (if / case) branches

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


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


----------------------------------------------------------------
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 #30853: [SPARK-33848][SQL] Push the UnaryExpression into (if / case) branches

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






----------------------------------------------------------------
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 #30853: [SPARK-33848][SQL] Push the cast into (if / case) branches

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


   **[Test build #133087 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/133087/testReport)** for PR 30853 at commit [`426b75d`](https://github.com/apache/spark/commit/426b75d3441f53dd87313a98f788180577b67031).


----------------------------------------------------------------
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 #30853: [SPARK-33848][SQL] Push the UnaryExpression into (if / case) branches

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


   **[Test build #133159 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/133159/testReport)** for PR 30853 at commit [`a0995d6`](https://github.com/apache/spark/commit/a0995d6404208cc05995ffbb3fd84ac3caf4156f).


----------------------------------------------------------------
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 #30853: [SPARK-33848][SQL] Push the cast into (if / case) branches

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



##########
File path: sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/optimizer/expressions.scala
##########
@@ -542,6 +542,18 @@ object PushFoldableIntoBranches extends Rule[LogicalPlan] with PredicateHelper {
 
   def apply(plan: LogicalPlan): LogicalPlan = plan transform {
     case q: LogicalPlan => q transformExpressionsUp {
+      case Cast(i @ If(_, trueValue, falseValue), dataType, timeZoneId)

Review comment:
       Good point. All unary expressions should work.




----------------------------------------------------------------
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 #30853: [SPARK-33848][SQL] Push the cast into (if / case) branches

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



##########
File path: sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/optimizer/expressions.scala
##########
@@ -542,6 +542,18 @@ object PushFoldableIntoBranches extends Rule[LogicalPlan] with PredicateHelper {
 
   def apply(plan: LogicalPlan): LogicalPlan = plan transform {
     case q: LogicalPlan => q transformExpressionsUp {
+      case Cast(i @ If(_, trueValue, falseValue), dataType, timeZoneId)

Review comment:
       how about `withNewChildren`? We should probably use that for binary expressions as well, to be safe.




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