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/07/09 20:42:57 UTC

[GitHub] [spark] viirya opened a new pull request #29061: [SPARK-32258][SQL] NormalizeFloatingNumbers can directly normalize on certain children expressions

viirya opened a new pull request #29061:
URL: https://github.com/apache/spark/pull/29061


   <!--
   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.
   -->
   
   This patch proposes to let `NormalizeFloatingNumbers` rule directly normalizes on certain children expressions. It could simplify expression tree.
   
   ### 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.
   -->
   
   Currently NormalizeFloatingNumbers rule treats some expressions as black box but we can optimize it a bit by normalizing directly the inner children expressions. 
   
   Also see https://github.com/apache/spark/pull/28962#discussion_r448526240.
   
   ### 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'.
   -->
   
   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.
   -->
   
   Unit 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 commented on pull request #29061: [SPARK-32258][SQL] NormalizeFloatingNumbers can directly normalize on certain children expressions

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


   **[Test build #125542 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/125542/testReport)** for PR 29061 at commit [`5046337`](https://github.com/apache/spark/commit/50463376b0547b3179557c31c095ed0f23fc74d1).


----------------------------------------------------------------
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 #29061: [SPARK-32258][SQL] NormalizeFloatingNumbers directly normalizes IF/CaseWhen/Coalesce child expressions

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


   **[Test build #125719 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/125719/testReport)** for PR 29061 at commit [`d5dce7c`](https://github.com/apache/spark/commit/d5dce7cdf7b5658687533b6ee5bbb76e0490a383).


----------------------------------------------------------------
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 #29061: [SPARK-32258][SQL] NormalizeFloatingNumbers directly normalizes IF/CaseWhen/Coalesce child expressions

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






----------------------------------------------------------------
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 #29061: [SPARK-32258][SQL] NormalizeFloatingNumbers directly normalizes IF/CaseWhen/Coalesce child expressions

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


   **[Test build #125719 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/125719/testReport)** for PR 29061 at commit [`d5dce7c`](https://github.com/apache/spark/commit/d5dce7cdf7b5658687533b6ee5bbb76e0490a383).


----------------------------------------------------------------
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 #29061: [SPARK-32258][SQL] NormalizeFloatingNumbers can directly normalize on IF and CaseWhen children expressions

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






----------------------------------------------------------------
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 #29061: [SPARK-32258][SQL] NormalizeFloatingNumbers can directly normalize on IF and CaseWhen children expressions

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


   **[Test build #125707 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/125707/testReport)** for PR 29061 at commit [`78b8667`](https://github.com/apache/spark/commit/78b866796c5b57f8e19e358648d9186ebeae7ba3).
    * 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 #29061: [SPARK-32258][SQL] NormalizeFloatingNumbers can directly normalize on IF and CaseWhen children expressions

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



##########
File path: sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/optimizer/NormalizeFloatingNumbers.scala
##########
@@ -116,6 +116,12 @@ object NormalizeFloatingNumbers extends Rule[LogicalPlan] {
     case CreateMap(children, useStringTypeWhenEmpty) =>
       CreateMap(children.map(normalize), useStringTypeWhenEmpty)
 
+    case If(cond, trueValue, falseValue) =>
+      If(cond, normalize(trueValue), normalize(falseValue))
+
+    case CaseWhen(branches, elseVale) =>
+      CaseWhen(branches.map(br => (br._1, normalize(br._2))), elseVale.map(normalize))
+

Review comment:
       shall we consider more pass-through expressions? like `Coalesce`?




----------------------------------------------------------------
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 #29061: [SPARK-32258][SQL] NormalizeFloatingNumbers can directly normalize on certain children expressions

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



##########
File path: sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/optimizer/NormalizeFloatingPointNumbersSuite.scala
##########
@@ -19,7 +19,7 @@ package org.apache.spark.sql.catalyst.optimizer
 
 import org.apache.spark.sql.catalyst.dsl.expressions._
 import org.apache.spark.sql.catalyst.dsl.plans._
-import org.apache.spark.sql.catalyst.expressions.{And, IsNull, KnownFloatingPointNormalized}
+import org.apache.spark.sql.catalyst.expressions.{And, CaseWhen, If, IsNull, KnownFloatingPointNormalized}

Review comment:
       nit: `And` not used?




----------------------------------------------------------------
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 #29061: [SPARK-32258][SQL] NormalizeFloatingNumbers directly normalizes IF/CaseWhen/Coalesce child expressions

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



##########
File path: sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/optimizer/NormalizeFloatingNumbers.scala
##########
@@ -116,6 +116,15 @@ object NormalizeFloatingNumbers extends Rule[LogicalPlan] {
     case CreateMap(children, useStringTypeWhenEmpty) =>
       CreateMap(children.map(normalize), useStringTypeWhenEmpty)
 
+    case If(cond, trueValue, falseValue) =>
+      If(cond, normalize(trueValue), normalize(falseValue))
+
+    case CaseWhen(branches, elseVale) =>
+      CaseWhen(branches.map(br => (br._1, normalize(br._2))), elseVale.map(normalize))
+
+    case Coalesce(children) =>
+      Coalesce(children.map(normalize))
+
     case _ if expr.dataType == FloatType || expr.dataType == DoubleType =>

Review comment:
       Shall we put these new cases after this case? The main goal of this optimization is to avoid constructing a new `CreateStruct` during normalization. If it's just a float/double type If/CashWhen/Coalesce, it's actually an overhead to duplicate the normalization work in each child.




----------------------------------------------------------------
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 #29061: [SPARK-32258][SQL] NormalizeFloatingNumbers can directly normalize on IF and CaseWhen children expressions

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






----------------------------------------------------------------
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 #29061: [SPARK-32258][SQL] NormalizeFloatingNumbers can directly normalize on certain children expressions

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






----------------------------------------------------------------
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 #29061: [SPARK-32258][SQL] NormalizeFloatingNumbers can directly normalize on IF and CaseWhen children expressions

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



##########
File path: sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/optimizer/NormalizeFloatingNumbers.scala
##########
@@ -116,6 +116,12 @@ object NormalizeFloatingNumbers extends Rule[LogicalPlan] {
     case CreateMap(children, useStringTypeWhenEmpty) =>
       CreateMap(children.map(normalize), useStringTypeWhenEmpty)
 
+    case If(cond, trueValue, falseValue) =>
+      If(cond, normalize(trueValue), normalize(falseValue))
+
+    case CaseWhen(branches, elseVale) =>
+      CaseWhen(branches.map(br => (br._1, normalize(br._2))), elseVale.map(normalize))
+

Review comment:
       Okay.




----------------------------------------------------------------
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 #29061: [SPARK-32258][SQL] NormalizeFloatingNumbers can directly normalize on IF and CaseWhen children expressions

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






----------------------------------------------------------------
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 #29061: [SPARK-32258][SQL] NormalizeFloatingNumbers can directly normalize on certain children expressions

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






----------------------------------------------------------------
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 #29061: [SPARK-32258][SQL] NormalizeFloatingNumbers directly normalizes IF/CaseWhen/Coalesce child expressions

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



##########
File path: sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/optimizer/NormalizeFloatingNumbers.scala
##########
@@ -116,6 +116,15 @@ object NormalizeFloatingNumbers extends Rule[LogicalPlan] {
     case CreateMap(children, useStringTypeWhenEmpty) =>
       CreateMap(children.map(normalize), useStringTypeWhenEmpty)
 
+    case If(cond, trueValue, falseValue) =>

Review comment:
       Although `cond` is `boolean` typed expression. I'm wondering what happens when we have a deeper expression at `cond`. Maybe, `normalize(cond)` is required here?




----------------------------------------------------------------
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 #29061: [SPARK-32258][SQL] NormalizeFloatingNumbers directly normalizes IF/CaseWhen/Coalesce child expressions

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



##########
File path: sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/optimizer/NormalizeFloatingPointNumbersSuite.scala
##########
@@ -85,8 +85,60 @@ class NormalizeFloatingPointNumbersSuite extends PlanTest {
     val optimized = Optimize.execute(query)
     val doubleOptimized = Optimize.execute(optimized)
     val joinCond = IsNull(a) === IsNull(b) &&
-      KnownFloatingPointNormalized(NormalizeNaNAndZero(coalesce(a, 0.0))) ===
-        KnownFloatingPointNormalized(NormalizeNaNAndZero(coalesce(b, 0.0)))
+      coalesce(KnownFloatingPointNormalized(NormalizeNaNAndZero(a)),
+        KnownFloatingPointNormalized(NormalizeNaNAndZero(0.0))) ===
+        coalesce(KnownFloatingPointNormalized(NormalizeNaNAndZero(b)),
+          KnownFloatingPointNormalized(NormalizeNaNAndZero(0.0)))
+    val correctAnswer = testRelation1.join(testRelation2, condition = Some(joinCond))
+
+    comparePlans(doubleOptimized, correctAnswer)
+  }
+
+  test("SPARK-32258: normalize the children of If") {
+    val cond = If(a > 0.1D, a, a + 0.2D) === b
+    val query = testRelation1.join(testRelation2, condition = Some(cond))
+    val optimized = Optimize.execute(query)
+    val doubleOptimized = Optimize.execute(optimized)
+
+    val joinCond = If(a > 0.1D,
+      KnownFloatingPointNormalized(NormalizeNaNAndZero(a)),
+        KnownFloatingPointNormalized(NormalizeNaNAndZero(a + 0.2D))) ===
+          KnownFloatingPointNormalized(NormalizeNaNAndZero(b))
+    val correctAnswer = testRelation1.join(testRelation2, condition = Some(joinCond))
+
+    comparePlans(doubleOptimized, correctAnswer)
+  }
+
+  test("SPARK-32258: normalize the children of Coalesce") {
+    val cond = If(a > 0.1D, a, a + 0.2D) <=> b
+    val query = testRelation1.join(testRelation2, condition = Some(cond))
+    val optimized = Optimize.execute(query)
+    val doubleOptimized = Optimize.execute(optimized)
+
+    /*
+    val joinCond = If(a > 0.1D,
+      KnownFloatingPointNormalized(NormalizeNaNAndZero(a)),
+      KnownFloatingPointNormalized(NormalizeNaNAndZero(a + 0.2D))) ===
+      KnownFloatingPointNormalized(NormalizeNaNAndZero(b))
+    val correctAnswer = testRelation1.join(testRelation2, condition = Some(joinCond))
+
+    comparePlans(doubleOptimized, correctAnswer)
+     */

Review comment:
       Oops. It is my test code. Let me remove it.




----------------------------------------------------------------
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 #29061: [SPARK-32258][SQL] NormalizeFloatingNumbers can directly normalize on certain children expressions

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






----------------------------------------------------------------
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 #29061: [SPARK-32258][SQL] NormalizeFloatingNumbers can directly normalize on IF and CaseWhen children expressions

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






----------------------------------------------------------------
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 #29061: [SPARK-32258][SQL] NormalizeFloatingNumbers can directly normalize on certain children expressions

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


   **[Test build #125513 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/125513/testReport)** for PR 29061 at commit [`f1652aa`](https://github.com/apache/spark/commit/f1652aaa7ef8f3157f7ea142f3bcb3219f08f9fd).
    * 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 #29061: [SPARK-32258][SQL] NormalizeFloatingNumbers can directly normalize on IF and CaseWhen children expressions

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


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


----------------------------------------------------------------
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 #29061: [SPARK-32258][SQL] NormalizeFloatingNumbers directly normalizes IF/CaseWhen/Coalesce child expressions

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



##########
File path: sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/optimizer/NormalizeFloatingNumbers.scala
##########
@@ -116,6 +116,15 @@ object NormalizeFloatingNumbers extends Rule[LogicalPlan] {
     case CreateMap(children, useStringTypeWhenEmpty) =>
       CreateMap(children.map(normalize), useStringTypeWhenEmpty)
 
+    case If(cond, trueValue, falseValue) =>

Review comment:
       Got it. I was confused a little. Thank you, @viirya .




----------------------------------------------------------------
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 #29061: [SPARK-32258][SQL] NormalizeFloatingNumbers directly normalizes IF/CaseWhen/Coalesce child expressions

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






----------------------------------------------------------------
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 #29061: [SPARK-32258][SQL] NormalizeFloatingNumbers can directly normalize on IF and CaseWhen children expressions

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


   **[Test build #125707 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/125707/testReport)** for PR 29061 at commit [`78b8667`](https://github.com/apache/spark/commit/78b866796c5b57f8e19e358648d9186ebeae7ba3).


----------------------------------------------------------------
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 #29061: [SPARK-32258][SQL] NormalizeFloatingNumbers can directly normalize on certain children expressions

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






----------------------------------------------------------------
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 #29061: [SPARK-32258][SQL] NormalizeFloatingNumbers can directly normalize on IF and CaseWhen children expressions

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






----------------------------------------------------------------
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 #29061: [SPARK-32258][SQL] NormalizeFloatingNumbers can directly normalize on IF and CaseWhen children expressions

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


   Merged build finished. Test FAILed.


----------------------------------------------------------------
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 #29061: [SPARK-32258][SQL] NormalizeFloatingNumbers can directly normalize on IF and CaseWhen children expressions

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


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


----------------------------------------------------------------
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 #29061: [SPARK-32258][SQL] NormalizeFloatingNumbers directly normalizes IF/CaseWhen/Coalesce child expressions

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



##########
File path: sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/optimizer/NormalizeFloatingPointNumbersSuite.scala
##########
@@ -85,8 +85,60 @@ class NormalizeFloatingPointNumbersSuite extends PlanTest {
     val optimized = Optimize.execute(query)
     val doubleOptimized = Optimize.execute(optimized)
     val joinCond = IsNull(a) === IsNull(b) &&
-      KnownFloatingPointNormalized(NormalizeNaNAndZero(coalesce(a, 0.0))) ===
-        KnownFloatingPointNormalized(NormalizeNaNAndZero(coalesce(b, 0.0)))
+      coalesce(KnownFloatingPointNormalized(NormalizeNaNAndZero(a)),
+        KnownFloatingPointNormalized(NormalizeNaNAndZero(0.0))) ===
+        coalesce(KnownFloatingPointNormalized(NormalizeNaNAndZero(b)),
+          KnownFloatingPointNormalized(NormalizeNaNAndZero(0.0)))
+    val correctAnswer = testRelation1.join(testRelation2, condition = Some(joinCond))
+
+    comparePlans(doubleOptimized, correctAnswer)
+  }
+
+  test("SPARK-32258: normalize the children of If") {
+    val cond = If(a > 0.1D, a, a + 0.2D) === b
+    val query = testRelation1.join(testRelation2, condition = Some(cond))
+    val optimized = Optimize.execute(query)
+    val doubleOptimized = Optimize.execute(optimized)
+
+    val joinCond = If(a > 0.1D,
+      KnownFloatingPointNormalized(NormalizeNaNAndZero(a)),
+        KnownFloatingPointNormalized(NormalizeNaNAndZero(a + 0.2D))) ===
+          KnownFloatingPointNormalized(NormalizeNaNAndZero(b))
+    val correctAnswer = testRelation1.join(testRelation2, condition = Some(joinCond))
+
+    comparePlans(doubleOptimized, correctAnswer)
+  }
+
+  test("SPARK-32258: normalize the children of Coalesce") {
+    val cond = If(a > 0.1D, a, a + 0.2D) <=> b
+    val query = testRelation1.join(testRelation2, condition = Some(cond))
+    val optimized = Optimize.execute(query)
+    val doubleOptimized = Optimize.execute(optimized)
+
+    /*
+    val joinCond = If(a > 0.1D,
+      KnownFloatingPointNormalized(NormalizeNaNAndZero(a)),
+      KnownFloatingPointNormalized(NormalizeNaNAndZero(a + 0.2D))) ===
+      KnownFloatingPointNormalized(NormalizeNaNAndZero(b))
+    val correctAnswer = testRelation1.join(testRelation2, condition = Some(joinCond))
+
+    comparePlans(doubleOptimized, correctAnswer)
+     */

Review comment:
       Shall we finish the above?




----------------------------------------------------------------
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 #29061: [SPARK-32258][SQL] NormalizeFloatingNumbers directly normalizes IF/CaseWhen/Coalesce child expressions

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



##########
File path: sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/optimizer/NormalizeFloatingNumbers.scala
##########
@@ -116,6 +116,15 @@ object NormalizeFloatingNumbers extends Rule[LogicalPlan] {
     case CreateMap(children, useStringTypeWhenEmpty) =>
       CreateMap(children.map(normalize), useStringTypeWhenEmpty)
 
+    case If(cond, trueValue, falseValue) =>

Review comment:
       Based on the doc of `NormalizeFloatingNumbers`, we handle that well during comparison. So the boolean condition is okay. We need normalize `trueValue` and `falseValue` because they could be passed through up to binary format in grouping/join/window partition.




----------------------------------------------------------------
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 #29061: [SPARK-32258][SQL] NormalizeFloatingNumbers can directly normalize on certain children expressions

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






----------------------------------------------------------------
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 #29061: [SPARK-32258][SQL] NormalizeFloatingNumbers can directly normalize on certain children expressions

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


   Merged build finished. Test FAILed.


----------------------------------------------------------------
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 #29061: [SPARK-32258][SQL] NormalizeFloatingNumbers can directly normalize on certain children expressions

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



##########
File path: sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/optimizer/NormalizeFloatingPointNumbersSuite.scala
##########
@@ -91,5 +91,38 @@ class NormalizeFloatingPointNumbersSuite extends PlanTest {
 
     comparePlans(doubleOptimized, correctAnswer)
   }
+
+  test("directly normalize on the children of If") {

Review comment:
       I guess we can remove `directly` here and line 110.




----------------------------------------------------------------
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 #29061: [SPARK-32258][SQL] NormalizeFloatingNumbers directly normalizes IF/CaseWhen/Coalesce child expressions

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


   


----------------------------------------------------------------
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 pull request #29061: [SPARK-32258][SQL] NormalizeFloatingNumbers can directly normalize on IF and CaseWhen children expressions

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


   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 #29061: [SPARK-32258][SQL] NormalizeFloatingNumbers can directly normalize on certain children expressions

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






----------------------------------------------------------------
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 #29061: [SPARK-32258][SQL] NormalizeFloatingNumbers can directly normalize on certain children expressions

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


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


----------------------------------------------------------------
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 #29061: [SPARK-32258][SQL] NormalizeFloatingNumbers can directly normalize on certain children expressions

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



##########
File path: sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/optimizer/NormalizeFloatingPointNumbersSuite.scala
##########
@@ -19,7 +19,7 @@ package org.apache.spark.sql.catalyst.optimizer
 
 import org.apache.spark.sql.catalyst.dsl.expressions._
 import org.apache.spark.sql.catalyst.dsl.plans._
-import org.apache.spark.sql.catalyst.expressions.{And, IsNull, KnownFloatingPointNormalized}
+import org.apache.spark.sql.catalyst.expressions.{And, CaseWhen, If, IsNull, KnownFloatingPointNormalized}

Review comment:
       yeah, removed




----------------------------------------------------------------
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 #29061: [SPARK-32258][SQL] NormalizeFloatingNumbers can directly normalize on certain children expressions

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






----------------------------------------------------------------
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 #29061: [SPARK-32258][SQL] NormalizeFloatingNumbers can directly normalize on IF and CaseWhen children expressions

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






----------------------------------------------------------------
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 #29061: [SPARK-32258][SQL] NormalizeFloatingNumbers can directly normalize on certain children expressions

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



##########
File path: sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/optimizer/NormalizeFloatingPointNumbersSuite.scala
##########
@@ -91,5 +91,38 @@ class NormalizeFloatingPointNumbersSuite extends PlanTest {
 
     comparePlans(doubleOptimized, correctAnswer)
   }
+
+  test("directly normalize on the children of If") {

Review comment:
       And, maybe, `normalize on the children` -> `normalize the children`?




----------------------------------------------------------------
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 #29061: [SPARK-32258][SQL] NormalizeFloatingNumbers can directly normalize on certain children expressions

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



##########
File path: sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/optimizer/NormalizeFloatingPointNumbersSuite.scala
##########
@@ -91,5 +91,38 @@ class NormalizeFloatingPointNumbersSuite extends PlanTest {
 
     comparePlans(doubleOptimized, correctAnswer)
   }
+
+  test("directly normalize on the children of If") {

Review comment:
       Okay.




----------------------------------------------------------------
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 #29061: [SPARK-32258][SQL] NormalizeFloatingNumbers directly normalizes IF/CaseWhen/Coalesce child expressions

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






----------------------------------------------------------------
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 #29061: [SPARK-32258][SQL] NormalizeFloatingNumbers can directly normalize on IF and CaseWhen children expressions

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


   **[Test build #125706 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/125706/testReport)** for PR 29061 at commit [`78b8667`](https://github.com/apache/spark/commit/78b866796c5b57f8e19e358648d9186ebeae7ba3).
    * This patch **fails due to an unknown error code, -9**.
    * 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] HyukjinKwon commented on a change in pull request #29061: [SPARK-32258][SQL] NormalizeFloatingNumbers can directly normalize on certain children expressions

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



##########
File path: sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/optimizer/NormalizeFloatingPointNumbersSuite.scala
##########
@@ -91,5 +91,38 @@ class NormalizeFloatingPointNumbersSuite extends PlanTest {
 
     comparePlans(doubleOptimized, correctAnswer)
   }
+
+  test("normalize the children of If") {

Review comment:
       nit: shall we put the JIRA id?




----------------------------------------------------------------
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 #29061: [SPARK-32258][SQL] NormalizeFloatingNumbers can directly normalize on IF and CaseWhen children expressions

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


   **[Test build #125706 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/125706/testReport)** for PR 29061 at commit [`78b8667`](https://github.com/apache/spark/commit/78b866796c5b57f8e19e358648d9186ebeae7ba3).


----------------------------------------------------------------
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 #29061: [SPARK-32258][SQL] NormalizeFloatingNumbers directly normalizes IF/CaseWhen/Coalesce child expressions

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



##########
File path: sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/optimizer/NormalizeFloatingNumbers.scala
##########
@@ -116,6 +116,15 @@ object NormalizeFloatingNumbers extends Rule[LogicalPlan] {
     case CreateMap(children, useStringTypeWhenEmpty) =>
       CreateMap(children.map(normalize), useStringTypeWhenEmpty)
 
+    case If(cond, trueValue, falseValue) =>

Review comment:
       I think we only need to have normalization on `trueValue3` and `falseValue3`, as they are the only results passing through the top-level `If`. The inner `If`s are evaluated during executing the top-level `If`. 




----------------------------------------------------------------
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 #29061: [SPARK-32258][SQL] NormalizeFloatingNumbers directly normalizes IF/CaseWhen/Coalesce child expressions

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


   **[Test build #125719 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/125719/testReport)** for PR 29061 at commit [`d5dce7c`](https://github.com/apache/spark/commit/d5dce7cdf7b5658687533b6ee5bbb76e0490a383).
    * 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] dongjoon-hyun commented on a change in pull request #29061: [SPARK-32258][SQL] NormalizeFloatingNumbers can directly normalize on certain children expressions

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



##########
File path: sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/optimizer/NormalizeFloatingNumbers.scala
##########
@@ -116,6 +116,12 @@ object NormalizeFloatingNumbers extends Rule[LogicalPlan] {
     case CreateMap(children, useStringTypeWhenEmpty) =>
       CreateMap(children.map(normalize), useStringTypeWhenEmpty)
 
+    case If(cond, trueValue, falseValue) =>
+      If(cond, normalize(trueValue), normalize(falseValue))
+
+    case CaseWhen(branches, elseVale) =>

Review comment:
       Could you narrow-down the PR title? For example, instead of `certain children expressions`, you can mention `IF` and `CaseWhen` specifically because this PR only handles those two.




----------------------------------------------------------------
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 #29061: [SPARK-32258][SQL] NormalizeFloatingNumbers can directly normalize on certain children expressions

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


   **[Test build #125513 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/125513/testReport)** for PR 29061 at commit [`f1652aa`](https://github.com/apache/spark/commit/f1652aaa7ef8f3157f7ea142f3bcb3219f08f9fd).


----------------------------------------------------------------
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 #29061: [SPARK-32258][SQL] NormalizeFloatingNumbers directly normalizes IF/CaseWhen/Coalesce child expressions

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



##########
File path: sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/optimizer/NormalizeFloatingNumbers.scala
##########
@@ -116,6 +116,15 @@ object NormalizeFloatingNumbers extends Rule[LogicalPlan] {
     case CreateMap(children, useStringTypeWhenEmpty) =>
       CreateMap(children.map(normalize), useStringTypeWhenEmpty)
 
+    case If(cond, trueValue, falseValue) =>

Review comment:
       What happen when we have `If(If(If(cond, trueValue1, falseValue1), trueValue2, falseValue2), trueValue3, falseValue3)`? We don't need to invoke `normalize` at `trueValue1~2` and `falseValue1~2`?




----------------------------------------------------------------
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 #29061: [SPARK-32258][SQL] NormalizeFloatingNumbers can directly normalize on certain children expressions

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



##########
File path: sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/optimizer/NormalizeFloatingPointNumbersSuite.scala
##########
@@ -91,5 +91,38 @@ class NormalizeFloatingPointNumbersSuite extends PlanTest {
 
     comparePlans(doubleOptimized, correctAnswer)
   }
+
+  test("normalize the children of If") {

Review comment:
       okay.




----------------------------------------------------------------
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 #29061: [SPARK-32258][SQL] NormalizeFloatingNumbers can directly normalize on IF and CaseWhen children expressions

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






----------------------------------------------------------------
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 #29061: [SPARK-32258][SQL] NormalizeFloatingNumbers can directly normalize on IF and CaseWhen children expressions

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


   **[Test build #125542 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/125542/testReport)** for PR 29061 at commit [`5046337`](https://github.com/apache/spark/commit/50463376b0547b3179557c31c095ed0f23fc74d1).


----------------------------------------------------------------
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 #29061: [SPARK-32258][SQL] NormalizeFloatingNumbers can directly normalize on IF and CaseWhen children expressions

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


   **[Test build #125706 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/125706/testReport)** for PR 29061 at commit [`78b8667`](https://github.com/apache/spark/commit/78b866796c5b57f8e19e358648d9186ebeae7ba3).


----------------------------------------------------------------
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 #29061: [SPARK-32258][SQL] NormalizeFloatingNumbers can directly normalize on certain children expressions

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


   **[Test build #125516 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/125516/testReport)** for PR 29061 at commit [`ba0ea32`](https://github.com/apache/spark/commit/ba0ea32e1e7e4bba54ab2468f44ee5da3b616dd6).


----------------------------------------------------------------
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 #29061: [SPARK-32258][SQL] NormalizeFloatingNumbers can directly normalize on IF and CaseWhen children expressions

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






----------------------------------------------------------------
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 #29061: [SPARK-32258][SQL] NormalizeFloatingNumbers directly normalizes IF/CaseWhen/Coalesce child expressions

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



##########
File path: sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/optimizer/NormalizeFloatingPointNumbersSuite.scala
##########
@@ -85,8 +85,60 @@ class NormalizeFloatingPointNumbersSuite extends PlanTest {
     val optimized = Optimize.execute(query)
     val doubleOptimized = Optimize.execute(optimized)
     val joinCond = IsNull(a) === IsNull(b) &&
-      KnownFloatingPointNormalized(NormalizeNaNAndZero(coalesce(a, 0.0))) ===
-        KnownFloatingPointNormalized(NormalizeNaNAndZero(coalesce(b, 0.0)))
+      coalesce(KnownFloatingPointNormalized(NormalizeNaNAndZero(a)),
+        KnownFloatingPointNormalized(NormalizeNaNAndZero(0.0))) ===
+        coalesce(KnownFloatingPointNormalized(NormalizeNaNAndZero(b)),
+          KnownFloatingPointNormalized(NormalizeNaNAndZero(0.0)))
+    val correctAnswer = testRelation1.join(testRelation2, condition = Some(joinCond))
+
+    comparePlans(doubleOptimized, correctAnswer)
+  }
+
+  test("SPARK-32258: normalize the children of If") {
+    val cond = If(a > 0.1D, a, a + 0.2D) === b
+    val query = testRelation1.join(testRelation2, condition = Some(cond))
+    val optimized = Optimize.execute(query)
+    val doubleOptimized = Optimize.execute(optimized)
+
+    val joinCond = If(a > 0.1D,
+      KnownFloatingPointNormalized(NormalizeNaNAndZero(a)),
+        KnownFloatingPointNormalized(NormalizeNaNAndZero(a + 0.2D))) ===
+          KnownFloatingPointNormalized(NormalizeNaNAndZero(b))
+    val correctAnswer = testRelation1.join(testRelation2, condition = Some(joinCond))
+
+    comparePlans(doubleOptimized, correctAnswer)
+  }
+
+  test("SPARK-32258: normalize the children of Coalesce") {
+    val cond = If(a > 0.1D, a, a + 0.2D) <=> b
+    val query = testRelation1.join(testRelation2, condition = Some(cond))
+    val optimized = Optimize.execute(query)
+    val doubleOptimized = Optimize.execute(optimized)
+
+    /*
+    val joinCond = If(a > 0.1D,
+      KnownFloatingPointNormalized(NormalizeNaNAndZero(a)),
+      KnownFloatingPointNormalized(NormalizeNaNAndZero(a + 0.2D))) ===
+      KnownFloatingPointNormalized(NormalizeNaNAndZero(b))
+    val correctAnswer = testRelation1.join(testRelation2, condition = Some(joinCond))
+
+    comparePlans(doubleOptimized, correctAnswer)
+     */

Review comment:
       ?




----------------------------------------------------------------
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 #29061: [SPARK-32258][SQL] NormalizeFloatingNumbers can directly normalize on IF and CaseWhen children expressions

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


   **[Test build #125542 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/125542/testReport)** for PR 29061 at commit [`5046337`](https://github.com/apache/spark/commit/50463376b0547b3179557c31c095ed0f23fc74d1).
    * This patch **fails due to an unknown error code, -9**.
    * 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 #29061: [SPARK-32258][SQL] NormalizeFloatingNumbers can directly normalize on IF and CaseWhen children expressions

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


   Merged build finished. Test FAILed.


----------------------------------------------------------------
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 #29061: [SPARK-32258][SQL] NormalizeFloatingNumbers can directly normalize on IF and CaseWhen children expressions

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



##########
File path: sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/optimizer/NormalizeFloatingNumbers.scala
##########
@@ -116,6 +116,12 @@ object NormalizeFloatingNumbers extends Rule[LogicalPlan] {
     case CreateMap(children, useStringTypeWhenEmpty) =>
       CreateMap(children.map(normalize), useStringTypeWhenEmpty)
 
+    case If(cond, trueValue, falseValue) =>
+      If(cond, normalize(trueValue), normalize(falseValue))
+
+    case CaseWhen(branches, elseVale) =>

Review comment:
       Updated. Thanks for the suggestion.




----------------------------------------------------------------
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 #29061: [SPARK-32258][SQL] NormalizeFloatingNumbers can directly normalize on IF and CaseWhen children expressions

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


   **[Test build #125707 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/125707/testReport)** for PR 29061 at commit [`78b8667`](https://github.com/apache/spark/commit/78b866796c5b57f8e19e358648d9186ebeae7ba3).


----------------------------------------------------------------
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 #29061: [SPARK-32258][SQL] NormalizeFloatingNumbers directly normalizes IF/CaseWhen/Coalesce child expressions

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



##########
File path: sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/optimizer/NormalizeFloatingNumbers.scala
##########
@@ -116,6 +116,15 @@ object NormalizeFloatingNumbers extends Rule[LogicalPlan] {
     case CreateMap(children, useStringTypeWhenEmpty) =>
       CreateMap(children.map(normalize), useStringTypeWhenEmpty)
 
+    case If(cond, trueValue, falseValue) =>

Review comment:
       Although a `cond` is `boolean` typed expression. I'm wondering what happens when we have a deeper expression at `cond`. Maybe, `normalize(cond)` is required here?




----------------------------------------------------------------
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 #29061: [SPARK-32258][SQL] NormalizeFloatingNumbers directly normalizes IF/CaseWhen/Coalesce child expressions

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



##########
File path: sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/optimizer/NormalizeFloatingNumbers.scala
##########
@@ -116,6 +116,15 @@ object NormalizeFloatingNumbers extends Rule[LogicalPlan] {
     case CreateMap(children, useStringTypeWhenEmpty) =>
       CreateMap(children.map(normalize), useStringTypeWhenEmpty)
 
+    case If(cond, trueValue, falseValue) =>
+      If(cond, normalize(trueValue), normalize(falseValue))
+
+    case CaseWhen(branches, elseVale) =>
+      CaseWhen(branches.map(br => (br._1, normalize(br._2))), elseVale.map(normalize))
+
+    case Coalesce(children) =>
+      Coalesce(children.map(normalize))
+
     case _ if expr.dataType == FloatType || expr.dataType == DoubleType =>

Review comment:
       Okay.




----------------------------------------------------------------
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 #29061: [SPARK-32258][SQL] NormalizeFloatingNumbers can directly normalize on IF and CaseWhen children expressions

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


   Merged build finished. Test PASSed.


----------------------------------------------------------------
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 #29061: [SPARK-32258][SQL] NormalizeFloatingNumbers directly normalizes IF/CaseWhen/Coalesce child expressions

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






----------------------------------------------------------------
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 #29061: [SPARK-32258][SQL] NormalizeFloatingNumbers can directly normalize on IF and CaseWhen children expressions

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


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


----------------------------------------------------------------
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 #29061: [SPARK-32258][SQL] NormalizeFloatingNumbers can directly normalize on certain children expressions

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


   **[Test build #125513 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/125513/testReport)** for PR 29061 at commit [`f1652aa`](https://github.com/apache/spark/commit/f1652aaa7ef8f3157f7ea142f3bcb3219f08f9fd).


----------------------------------------------------------------
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 #29061: [SPARK-32258][SQL] NormalizeFloatingNumbers can directly normalize on IF and CaseWhen children expressions

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


   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