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/07 16:27:27 UTC

[GitHub] [spark] cloud-fan opened a new pull request #29026: [SPARK-28067][SPARK-32018] fix decimal overflow issues

cloud-fan opened a new pull request #29026:
URL: https://github.com/apache/spark/pull/29026


   <!--
   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 is a followup of https://github.com/apache/spark/pull/27627 to fix the remaining issues. There are 2 issues fixed in this PR:
   1. `UnsafeRow.setDecimal` can set an overflowed decimal and causes an error when reading it. The expected behavior is to return null.
   2. The update/merge expression in `Sum` is wrong. We shouldn't turn the `sum` value back to 0 after it becomes null due to overflow. This issue was hidden because:
   2.1 for hash aggregate, the buffer is unsafe row. Due to the first bug, we fail when overflow happens, so there is no chance to mistakenly turn null back to 0.
   2.2 for sort-based aggregate, the buffer is generic row. The decimal can overflow (the Decimal class has unlimited precision) and we don't have the null problem.
   
   If we only fix the first bug, then the second bug is exposed and test fails. If we only fix the second bug, there is no way to test it. This PR fixes these 2 bugs together.
   
   ### 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.
   -->
   Fix issues during decimal sum when overflow happens
   
   ### Does this PR introduce _any_ user-facing change?
   <!--
   Note that it means *any* user-facing change including all aspects such as the documentation fix.
   If yes, please clarify the previous behavior and the change this PR proposes - provide the console output, description and/or an example to show the behavior difference if possible.
   If possible, please also clarify if this is a user-facing change compared to the released Spark versions or within the unreleased branches such as master.
   If no, write 'No'.
   -->
   Yes. Now decimal sum can return null correctly for overflow under non-ansi mode.
   
   ### 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.
   -->
   new test and updated test


----------------------------------------------------------------
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 #29026: [SPARK-28067][SPARK-32018] Fix decimal overflow issues

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


   Merged to master.


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



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


[GitHub] [spark] SparkQA commented on pull request #29026: [SPARK-28067][SPARK-32018] Fix decimal overflow issues

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


   **[Test build #125301 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/125301/testReport)** for PR 29026 at commit [`3717fc6`](https://github.com/apache/spark/commit/3717fc618548d80464788d07a9b1f81f4418ed81).


----------------------------------------------------------------
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 #29026: [SPARK-28067][SPARK-32018] Fix decimal overflow issues

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


   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 #29026: [SPARK-28067][SPARK-32018] Fix decimal overflow issues

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






----------------------------------------------------------------
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 #29026: [SPARK-28067][SPARK-32018] Fix decimal overflow issues

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






----------------------------------------------------------------
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 #29026: [SPARK-28067][SPARK-32018] Fix decimal overflow issues

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


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


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



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


[GitHub] [spark] AmplabJenkins commented on pull request #29026: [SPARK-28067][SPARK-32018] Fix decimal overflow issues

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






----------------------------------------------------------------
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 #29026: [SPARK-28067][SPARK-32018] Fix decimal overflow issues

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


   **[Test build #125301 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/125301/testReport)** for PR 29026 at commit [`3717fc6`](https://github.com/apache/spark/commit/3717fc618548d80464788d07a9b1f81f4418ed81).


----------------------------------------------------------------
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 #29026: [SPARK-28067][SPARK-32018] Fix decimal overflow issues

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


   **[Test build #125422 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/125422/testReport)** for PR 29026 at commit [`3717fc6`](https://github.com/apache/spark/commit/3717fc618548d80464788d07a9b1f81f4418ed81).


----------------------------------------------------------------
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 #29026: [SPARK-28067][SPARK-32018] Fix decimal overflow issues

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



##########
File path: sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/aggregate/Sum.scala
##########
@@ -58,39 +58,50 @@ case class Sum(child: Expression) extends DeclarativeAggregate with ImplicitCast
     case _ => DoubleType
   }
 
-  private lazy val sumDataType = resultType
-
-  private lazy val sum = AttributeReference("sum", sumDataType)()
+  private lazy val sum = AttributeReference("sum", resultType)()
 
   private lazy val isEmpty = AttributeReference("isEmpty", BooleanType, nullable = false)()
 
-  private lazy val zero = Literal.default(sumDataType)
+  private lazy val zero = Literal.default(resultType)
 
   override lazy val aggBufferAttributes = resultType match {
     case _: DecimalType => sum :: isEmpty :: Nil
     case _ => sum :: Nil
   }
 
   override lazy val initialValues: Seq[Expression] = resultType match {
-    case _: DecimalType => Seq(Literal(null, resultType), Literal(true, BooleanType))
+    case _: DecimalType => Seq(zero, Literal(true, BooleanType))
     case _ => Seq(Literal(null, resultType))
   }
 
   override lazy val updateExpressions: Seq[Expression] = {
-    if (child.nullable) {
-      val updateSumExpr = coalesce(coalesce(sum, zero) + child.cast(sumDataType), sum)
-      resultType match {
-        case _: DecimalType =>
-          Seq(updateSumExpr, isEmpty && child.isNull)
-        case _ => Seq(updateSumExpr)
-      }
-    } else {
-      val updateSumExpr = coalesce(sum, zero) + child.cast(sumDataType)
-      resultType match {
-        case _: DecimalType =>
-          Seq(updateSumExpr, Literal(false, BooleanType))
-        case _ => Seq(updateSumExpr)
-      }
+    resultType match {
+      case _: DecimalType =>
+        // For decimal type, the initial value of `sum` is 0. We need to keep `sum` unchanged if
+        // the input is null, as SUM function ignores null input. The `sum` can only be null if
+        // overflow happens under non-ansi mode.

Review comment:
       Do you mean `checkOverflow` in `Add` expression? If it is enabled, for `DecimalType`, `DecimalExactNumeric` is used for `plus` operation.
   
   But I don't see it has overrided `plus` behavior to check overflow and respect the ansi mode. Am I missing 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] cloud-fan commented on a change in pull request #29026: [SPARK-28067][SPARK-32018] Fix decimal overflow issues

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



##########
File path: sql/catalyst/src/main/java/org/apache/spark/sql/catalyst/expressions/UnsafeRow.java
##########
@@ -288,7 +288,7 @@ public void setDecimal(int ordinal, Decimal value, int precision) {
       Platform.putLong(baseObject, baseOffset + cursor, 0L);
       Platform.putLong(baseObject, baseOffset + cursor + 8, 0L);
 
-      if (value == null) {
+      if (value == null || !value.changePrecision(precision, value.scale())) {

Review comment:
       Yes we should




----------------------------------------------------------------
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 #29026: [SPARK-28067][SPARK-32018] Fix decimal overflow issues

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



##########
File path: sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/aggregate/Sum.scala
##########
@@ -58,39 +58,50 @@ case class Sum(child: Expression) extends DeclarativeAggregate with ImplicitCast
     case _ => DoubleType
   }
 
-  private lazy val sumDataType = resultType
-
-  private lazy val sum = AttributeReference("sum", sumDataType)()
+  private lazy val sum = AttributeReference("sum", resultType)()
 
   private lazy val isEmpty = AttributeReference("isEmpty", BooleanType, nullable = false)()
 
-  private lazy val zero = Literal.default(sumDataType)
+  private lazy val zero = Literal.default(resultType)
 
   override lazy val aggBufferAttributes = resultType match {
     case _: DecimalType => sum :: isEmpty :: Nil
     case _ => sum :: Nil
   }
 
   override lazy val initialValues: Seq[Expression] = resultType match {
-    case _: DecimalType => Seq(Literal(null, resultType), Literal(true, BooleanType))
+    case _: DecimalType => Seq(zero, Literal(true, BooleanType))
     case _ => Seq(Literal(null, resultType))
   }
 
   override lazy val updateExpressions: Seq[Expression] = {
-    if (child.nullable) {
-      val updateSumExpr = coalesce(coalesce(sum, zero) + child.cast(sumDataType), sum)
-      resultType match {
-        case _: DecimalType =>
-          Seq(updateSumExpr, isEmpty && child.isNull)
-        case _ => Seq(updateSumExpr)
-      }
-    } else {
-      val updateSumExpr = coalesce(sum, zero) + child.cast(sumDataType)
-      resultType match {
-        case _: DecimalType =>
-          Seq(updateSumExpr, Literal(false, BooleanType))
-        case _ => Seq(updateSumExpr)
-      }
+    resultType match {
+      case _: DecimalType =>
+        // For decimal type, the initial value of `sum` is 0. We need to keep `sum` unchanged if
+        // the input is null, as SUM function ignores null input. The `sum` can only be null if
+        // overflow happens under non-ansi mode.

Review comment:
       <del>Do you mean `checkOverflow` in `Add` expression? If it is enabled, for `DecimalType`, `DecimalExactNumeric` is used for `plus` operation.
   
   But I don't see it has overrided `plus` behavior to check overflow and respect the ansi mode. Am I missing it?</del>




----------------------------------------------------------------
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 #29026: [SPARK-28067][SPARK-32018] Fix decimal overflow issues

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



##########
File path: sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/aggregate/Sum.scala
##########
@@ -58,39 +58,50 @@ case class Sum(child: Expression) extends DeclarativeAggregate with ImplicitCast
     case _ => DoubleType
   }
 
-  private lazy val sumDataType = resultType
-
-  private lazy val sum = AttributeReference("sum", sumDataType)()
+  private lazy val sum = AttributeReference("sum", resultType)()
 
   private lazy val isEmpty = AttributeReference("isEmpty", BooleanType, nullable = false)()
 
-  private lazy val zero = Literal.default(sumDataType)
+  private lazy val zero = Literal.default(resultType)
 
   override lazy val aggBufferAttributes = resultType match {
     case _: DecimalType => sum :: isEmpty :: Nil
     case _ => sum :: Nil
   }
 
   override lazy val initialValues: Seq[Expression] = resultType match {
-    case _: DecimalType => Seq(Literal(null, resultType), Literal(true, BooleanType))
+    case _: DecimalType => Seq(zero, Literal(true, BooleanType))
     case _ => Seq(Literal(null, resultType))
   }
 
   override lazy val updateExpressions: Seq[Expression] = {
-    if (child.nullable) {
-      val updateSumExpr = coalesce(coalesce(sum, zero) + child.cast(sumDataType), sum)
-      resultType match {
-        case _: DecimalType =>
-          Seq(updateSumExpr, isEmpty && child.isNull)
-        case _ => Seq(updateSumExpr)
-      }
-    } else {
-      val updateSumExpr = coalesce(sum, zero) + child.cast(sumDataType)
-      resultType match {
-        case _: DecimalType =>
-          Seq(updateSumExpr, Literal(false, BooleanType))
-        case _ => Seq(updateSumExpr)
-      }
+    resultType match {
+      case _: DecimalType =>
+        // For decimal type, the initial value of `sum` is 0. We need to keep `sum` unchanged if
+        // the input is null, as SUM function ignores null input. The `sum` can only be null if
+        // overflow happens under non-ansi mode.

Review comment:
       <del>Do you mean `checkOverflow` in `Add` expression? If it is enabled, for `DecimalType`, `DecimalExactNumeric` is used for `plus` operation.</del>
   
   <del>But I don't see it has overrided `plus` behavior to check overflow and respect the ansi mode. Am I missing it?</del>




----------------------------------------------------------------
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 #29026: [SPARK-28067][SPARK-32018] Fix decimal overflow issues

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


   **[Test build #125301 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/125301/testReport)** for PR 29026 at commit [`3717fc6`](https://github.com/apache/spark/commit/3717fc618548d80464788d07a9b1f81f4418ed81).
    * This patch **fails to generate documentation**.
    * 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 #29026: [SPARK-28067][SPARK-32018] Fix decimal overflow issues

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






----------------------------------------------------------------
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 #29026: [SPARK-28067][SPARK-32018] Fix decimal overflow issues

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






----------------------------------------------------------------
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 #29026: [SPARK-28067][SPARK-32018] Fix decimal overflow issues

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


   **[Test build #125254 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/125254/testReport)** for PR 29026 at commit [`3717fc6`](https://github.com/apache/spark/commit/3717fc618548d80464788d07a9b1f81f4418ed81).
    * This patch **fails PySpark 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 #29026: [SPARK-28067][SPARK-32018] Fix decimal overflow issues

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


   Test FAILed.
   Refer to this link for build results (access rights to CI server needed): 
   https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/125254/
   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] SparkQA removed a comment on pull request #29026: [SPARK-28067][SPARK-32018] Fix decimal overflow issues

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






----------------------------------------------------------------
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 #29026: [SPARK-28067][SPARK-32018] Fix decimal overflow issues

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






----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



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


[GitHub] [spark] cloud-fan commented on pull request #29026: [SPARK-28067][SPARK-32018] Fix decimal overflow issues

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


   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] skambha commented on a change in pull request #29026: [SPARK-28067][SPARK-32018] Fix decimal overflow issues

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



##########
File path: sql/core/src/test/scala/org/apache/spark/sql/UnsafeRowSuite.scala
##########
@@ -178,4 +178,14 @@ class UnsafeRowSuite extends SparkFunSuite {
     // Makes sure hashCode on unsafe array won't crash
     unsafeRow.getArray(0).hashCode()
   }
+
+  test("SPARK-32018: setDecimal with overflowed value") {
+    val d1 = new Decimal().set(BigDecimal("10000000000000000000")).toPrecision(38, 18)
+    val row = InternalRow.apply(d1)
+    val unsafeRow = UnsafeProjection.create(Array[DataType](DecimalType(38, 18))).apply(row)
+    assert(unsafeRow.getDecimal(0, 38, 18) === d1)
+    val d2 = (d1 * Decimal(10)).toPrecision(39, 18)
+    unsafeRow.setDecimal(0, d2, 38)
+    assert(unsafeRow.getDecimal(0, 38, 18) === null)

Review comment:
       What happens with ansi mode true?  




----------------------------------------------------------------
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] skambha edited a comment on pull request #29026: [SPARK-28067][SPARK-32018] Fix decimal overflow issues

Posted by GitBox <gi...@apache.org>.
skambha edited a comment on pull request #29026:
URL: https://github.com/apache/spark/pull/29026#issuecomment-655252629


   @cloud-fan, Thanks for looking into covering some more cases.  If we change the UnsafeRow.setDecimal overflow logic, I agree the implementation of the sum needs to change. This is coming back to the discussion we had earlier here (https://github.com/skambha/spark/pull/1), the sum overflow logic is very much dependent on the underlying implementation of overflow logic in UnsafeRowWriter and UnsafeRow etc.  
   
   I have a few comments related to the fix in UnsafeRow.
   1) So now we have UnsafeRow.setDecimal silently returns a null for an overflowed decimal value in setDecimal, but getDecimal throws error.  There is inconsistency here.  Why is that ok?  Also, they dont honor the ansi mode. 
   
   2) In this scenario, now we are more aggressive in the checking of the overflow. We have moved the overflow check further down to return null.   Earlier I think the decision was to not do the checking per row, but now dont we end up doing that in some of the cases, right?  


----------------------------------------------------------------
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] anuragmantri commented on pull request #29026: [SPARK-28067][SPARK-32018] Fix decimal overflow issues

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


   @maropu - Thanks for pointing me to the discussion thread. Sorry I got lost a bit with so many threads. I will park this idea for now since SPARK-28067 is not in any release branches yet.


----------------------------------------------------------------
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 #29026: [SPARK-28067][SPARK-32018] fix decimal overflow issues

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






----------------------------------------------------------------
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 #29026: [SPARK-28067][SPARK-32018] fix decimal overflow issues

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



##########
File path: sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/aggregate/Sum.scala
##########
@@ -58,39 +58,50 @@ case class Sum(child: Expression) extends DeclarativeAggregate with ImplicitCast
     case _ => DoubleType
   }
 
-  private lazy val sumDataType = resultType
-
-  private lazy val sum = AttributeReference("sum", sumDataType)()
+  private lazy val sum = AttributeReference("sum", resultType)()
 
   private lazy val isEmpty = AttributeReference("isEmpty", BooleanType, nullable = false)()
 
-  private lazy val zero = Literal.default(sumDataType)
+  private lazy val zero = Literal.default(resultType)
 
   override lazy val aggBufferAttributes = resultType match {
     case _: DecimalType => sum :: isEmpty :: Nil
     case _ => sum :: Nil
   }
 
   override lazy val initialValues: Seq[Expression] = resultType match {
-    case _: DecimalType => Seq(Literal(null, resultType), Literal(true, BooleanType))
+    case _: DecimalType => Seq(zero, Literal(true, BooleanType))
     case _ => Seq(Literal(null, resultType))
   }
 
   override lazy val updateExpressions: Seq[Expression] = {
-    if (child.nullable) {
-      val updateSumExpr = coalesce(coalesce(sum, zero) + child.cast(sumDataType), sum)
-      resultType match {
-        case _: DecimalType =>
-          Seq(updateSumExpr, isEmpty && child.isNull)
-        case _ => Seq(updateSumExpr)
-      }
-    } else {
-      val updateSumExpr = coalesce(sum, zero) + child.cast(sumDataType)
-      resultType match {
-        case _: DecimalType =>
-          Seq(updateSumExpr, Literal(false, BooleanType))
-        case _ => Seq(updateSumExpr)
-      }
+    resultType match {
+      case _: DecimalType =>
+        // For decimal type, the initial value of `sum` is 0. We need to keep `sum` unchanged if
+        // the input is null, as SUM function ignores null input. The `sum` can only be null if
+        // overflow happens under non-ansi mode.

Review comment:
       When in `updateExpressions`, I think ansi-mode or not doesn't change the behavior. Maybe just `The sum can only be null if overflow happens`?
   




----------------------------------------------------------------
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 #29026: [SPARK-28067][SPARK-32018] Fix decimal overflow issues

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






----------------------------------------------------------------
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 #29026: [SPARK-28067][SPARK-32018] Fix decimal overflow issues

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






----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



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


[GitHub] [spark] cloud-fan commented on pull request #29026: [SPARK-28067][SPARK-32018] Fix decimal overflow issues

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


   There was an attempt to backport this fix but we decided not to as it breaks backward compatibility. See https://github.com/apache/spark/pull/29448#issuecomment-674723823


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



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


[GitHub] [spark] cloud-fan commented on pull request #29026: [SPARK-28067][SPARK-32018] fix decimal overflow issues

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


   cc @skambha @rednaxelafx @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 commented on pull request #29026: [SPARK-28067][SPARK-32018] Fix decimal overflow issues

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






----------------------------------------------------------------
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 #29026: [SPARK-28067][SPARK-32018] Fix decimal overflow issues

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


   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] SparkQA commented on pull request #29026: [SPARK-28067][SPARK-32018] fix decimal overflow issues

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


   **[Test build #125235 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/125235/testReport)** for PR 29026 at commit [`3717fc6`](https://github.com/apache/spark/commit/3717fc618548d80464788d07a9b1f81f4418ed81).


----------------------------------------------------------------
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] skambha commented on pull request #29026: [SPARK-28067][SPARK-32018] Fix decimal overflow issues

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


   @cloud-fan, Thanks for looking into covering some more cases.  If we change the UnsafeRow.setDecimal overflow logic, I agree the implementation of the sum needs to change. This is coming back to the discussion we had earlier here (https://github.com/skambha/spark/pull/1), the sum overflow logic is very much dependent on the underlying implementation of overflow logic in UnsafeRowWriter and UnsafeRow etc.  
   
   I have a few comments related to the fix in UnsafeRow.
   1) So now we have UnsafeRow.setDecimal silently returns a null for an overflowed decimal value in setDecimal, but getDecimal throws error.  There is inconsistency here.  Why is that ok?  Also, they dont honor the ansi mode. 
   
   2)In this scenario, now we are more aggressive in the checking of the overflow. We have moved the overflow check further down to return null.   Earlier I think the decision was to not do the checking per row, but now dont we end up doing that in some of the cases, right?  


----------------------------------------------------------------
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 removed a comment on pull request #29026: [SPARK-28067][SPARK-32018] Fix decimal overflow issues

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


   +1


----------------------------------------------------------------
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 #29026: [SPARK-28067][SPARK-32018] Fix decimal overflow issues

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



##########
File path: sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/aggregate/Sum.scala
##########
@@ -58,39 +58,50 @@ case class Sum(child: Expression) extends DeclarativeAggregate with ImplicitCast
     case _ => DoubleType
   }
 
-  private lazy val sumDataType = resultType
-
-  private lazy val sum = AttributeReference("sum", sumDataType)()
+  private lazy val sum = AttributeReference("sum", resultType)()
 
   private lazy val isEmpty = AttributeReference("isEmpty", BooleanType, nullable = false)()
 
-  private lazy val zero = Literal.default(sumDataType)
+  private lazy val zero = Literal.default(resultType)
 
   override lazy val aggBufferAttributes = resultType match {
     case _: DecimalType => sum :: isEmpty :: Nil
     case _ => sum :: Nil
   }
 
   override lazy val initialValues: Seq[Expression] = resultType match {
-    case _: DecimalType => Seq(Literal(null, resultType), Literal(true, BooleanType))
+    case _: DecimalType => Seq(zero, Literal(true, BooleanType))
     case _ => Seq(Literal(null, resultType))
   }
 
   override lazy val updateExpressions: Seq[Expression] = {
-    if (child.nullable) {
-      val updateSumExpr = coalesce(coalesce(sum, zero) + child.cast(sumDataType), sum)
-      resultType match {
-        case _: DecimalType =>
-          Seq(updateSumExpr, isEmpty && child.isNull)
-        case _ => Seq(updateSumExpr)
-      }
-    } else {
-      val updateSumExpr = coalesce(sum, zero) + child.cast(sumDataType)
-      resultType match {
-        case _: DecimalType =>
-          Seq(updateSumExpr, Literal(false, BooleanType))
-        case _ => Seq(updateSumExpr)
-      }
+    resultType match {
+      case _: DecimalType =>
+        // For decimal type, the initial value of `sum` is 0. We need to keep `sum` unchanged if
+        // the input is null, as SUM function ignores null input. The `sum` can only be null if
+        // overflow happens under non-ansi mode.

Review comment:
       Ah, I see. There is separate rule to handle overflow of Decimal.




----------------------------------------------------------------
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 #29026: [SPARK-28067][SPARK-32018] fix decimal overflow issues

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



##########
File path: sql/catalyst/src/main/java/org/apache/spark/sql/catalyst/expressions/UnsafeRow.java
##########
@@ -288,7 +288,7 @@ public void setDecimal(int ordinal, Decimal value, int precision) {
       Platform.putLong(baseObject, baseOffset + cursor, 0L);
       Platform.putLong(baseObject, baseOffset + cursor + 8, 0L);
 
-      if (value == null) {
+      if (value == null || !value.changePrecision(precision, value.scale())) {

Review comment:
       Thanks to @allisonwang-db for catching this bug!




----------------------------------------------------------------
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 #29026: [SPARK-28067][SPARK-32018] Fix decimal overflow issues

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


   **[Test build #125422 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/125422/testReport)** for PR 29026 at commit [`3717fc6`](https://github.com/apache/spark/commit/3717fc618548d80464788d07a9b1f81f4418ed81).


----------------------------------------------------------------
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 #29026: [SPARK-28067][SPARK-32018] Fix decimal overflow issues

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


   **[Test build #125383 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/125383/testReport)** for PR 29026 at commit [`3717fc6`](https://github.com/apache/spark/commit/3717fc618548d80464788d07a9b1f81f4418ed81).


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



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


[GitHub] [spark] dongjoon-hyun commented on pull request #29026: [SPARK-28067][SPARK-32018] fix decimal overflow issues

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


   Hi, @cloud-fan . SPARK-28067 is merged for 3.1.0 only. This also aims 3.1.0 only?


----------------------------------------------------------------
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 #29026: [SPARK-28067][SPARK-32018] Fix decimal overflow issues

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


   Test FAILed.
   Refer to this link for build results (access rights to CI server needed): 
   https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/125383/
   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] cloud-fan edited a comment on pull request #29026: [SPARK-28067][SPARK-32018] Fix decimal overflow issues

Posted by GitBox <gi...@apache.org>.
cloud-fan edited a comment on pull request #29026:
URL: https://github.com/apache/spark/pull/29026#issuecomment-705305987


   There was an attempt to backport this fix but we decided not to as it breaks streaming backward compatibility. We can't backport part of the fix either, see https://github.com/apache/spark/pull/29448#issuecomment-674723823


----------------------------------------------------------------
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 #29026: [SPARK-28067][SPARK-32018] Fix decimal overflow issues

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


   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] dongjoon-hyun commented on pull request #29026: [SPARK-28067][SPARK-32018] Fix decimal overflow issues

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


   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] dongjoon-hyun commented on a change in pull request #29026: [SPARK-28067][SPARK-32018] Fix decimal overflow issues

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



##########
File path: sql/catalyst/src/main/java/org/apache/spark/sql/catalyst/expressions/UnsafeRow.java
##########
@@ -288,7 +288,7 @@ public void setDecimal(int ordinal, Decimal value, int precision) {
       Platform.putLong(baseObject, baseOffset + cursor, 0L);
       Platform.putLong(baseObject, baseOffset + cursor + 8, 0L);
 
-      if (value == null) {
+      if (value == null || !value.changePrecision(precision, value.scale())) {

Review comment:
       This looks valid for branch-3.0 and branch-2.4. Do you think we need to backport to to branch-2.4?




----------------------------------------------------------------
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 #29026: [SPARK-28067][SPARK-32018] Fix decimal overflow issues

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


   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] viirya commented on a change in pull request #29026: [SPARK-28067][SPARK-32018] Fix decimal overflow issues

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



##########
File path: sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/aggregate/Sum.scala
##########
@@ -58,39 +58,50 @@ case class Sum(child: Expression) extends DeclarativeAggregate with ImplicitCast
     case _ => DoubleType
   }
 
-  private lazy val sumDataType = resultType
-
-  private lazy val sum = AttributeReference("sum", sumDataType)()
+  private lazy val sum = AttributeReference("sum", resultType)()
 
   private lazy val isEmpty = AttributeReference("isEmpty", BooleanType, nullable = false)()
 
-  private lazy val zero = Literal.default(sumDataType)
+  private lazy val zero = Literal.default(resultType)
 
   override lazy val aggBufferAttributes = resultType match {
     case _: DecimalType => sum :: isEmpty :: Nil
     case _ => sum :: Nil
   }
 
   override lazy val initialValues: Seq[Expression] = resultType match {
-    case _: DecimalType => Seq(Literal(null, resultType), Literal(true, BooleanType))
+    case _: DecimalType => Seq(zero, Literal(true, BooleanType))
     case _ => Seq(Literal(null, resultType))
   }
 
   override lazy val updateExpressions: Seq[Expression] = {
-    if (child.nullable) {
-      val updateSumExpr = coalesce(coalesce(sum, zero) + child.cast(sumDataType), sum)
-      resultType match {
-        case _: DecimalType =>
-          Seq(updateSumExpr, isEmpty && child.isNull)
-        case _ => Seq(updateSumExpr)
-      }
-    } else {
-      val updateSumExpr = coalesce(sum, zero) + child.cast(sumDataType)
-      resultType match {
-        case _: DecimalType =>
-          Seq(updateSumExpr, Literal(false, BooleanType))
-        case _ => Seq(updateSumExpr)
-      }
+    resultType match {
+      case _: DecimalType =>
+        // For decimal type, the initial value of `sum` is 0. We need to keep `sum` unchanged if
+        // the input is null, as SUM function ignores null input. The `sum` can only be null if
+        // overflow happens under non-ansi mode.

Review comment:
       Ah, I see. There is separate to handle overflow of Decimal.




----------------------------------------------------------------
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 #29026: [SPARK-28067][SPARK-32018] Fix decimal overflow issues

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






----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



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


[GitHub] [spark] cloud-fan commented on pull request #29026: [SPARK-28067][SPARK-32018] Fix decimal overflow issues

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


   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] AmplabJenkins commented on pull request #29026: [SPARK-28067][SPARK-32018] Fix decimal overflow issues

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






----------------------------------------------------------------
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 #29026: [SPARK-28067][SPARK-32018] fix decimal overflow issues

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






----------------------------------------------------------------
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 #29026: [SPARK-28067][SPARK-32018] Fix decimal overflow issues

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



##########
File path: sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/aggregate/Sum.scala
##########
@@ -58,39 +58,50 @@ case class Sum(child: Expression) extends DeclarativeAggregate with ImplicitCast
     case _ => DoubleType
   }
 
-  private lazy val sumDataType = resultType
-
-  private lazy val sum = AttributeReference("sum", sumDataType)()
+  private lazy val sum = AttributeReference("sum", resultType)()
 
   private lazy val isEmpty = AttributeReference("isEmpty", BooleanType, nullable = false)()
 
-  private lazy val zero = Literal.default(sumDataType)
+  private lazy val zero = Literal.default(resultType)
 
   override lazy val aggBufferAttributes = resultType match {
     case _: DecimalType => sum :: isEmpty :: Nil
     case _ => sum :: Nil
   }
 
   override lazy val initialValues: Seq[Expression] = resultType match {
-    case _: DecimalType => Seq(Literal(null, resultType), Literal(true, BooleanType))
+    case _: DecimalType => Seq(zero, Literal(true, BooleanType))
     case _ => Seq(Literal(null, resultType))
   }
 
   override lazy val updateExpressions: Seq[Expression] = {
-    if (child.nullable) {
-      val updateSumExpr = coalesce(coalesce(sum, zero) + child.cast(sumDataType), sum)
-      resultType match {
-        case _: DecimalType =>
-          Seq(updateSumExpr, isEmpty && child.isNull)
-        case _ => Seq(updateSumExpr)
-      }
-    } else {
-      val updateSumExpr = coalesce(sum, zero) + child.cast(sumDataType)
-      resultType match {
-        case _: DecimalType =>
-          Seq(updateSumExpr, Literal(false, BooleanType))
-        case _ => Seq(updateSumExpr)
-      }
+    resultType match {
+      case _: DecimalType =>
+        // For decimal type, the initial value of `sum` is 0. We need to keep `sum` unchanged if
+        // the input is null, as SUM function ignores null input. The `sum` can only be null if
+        // overflow happens under non-ansi mode.

Review comment:
       Do you mean `checkOverflow` in `Add` expression? If it is enabled, for `DecimalType`, `DecimalExactNumeric` is used for `plus` operation. But I don't see it has overrided `plus` behavior to check overflow and respect the ansi mode.




----------------------------------------------------------------
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 #29026: [SPARK-28067][SPARK-32018] Fix decimal overflow issues

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






----------------------------------------------------------------
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 #29026: [SPARK-28067][SPARK-32018] Fix decimal overflow issues

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


   **[Test build #125302 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/125302/testReport)** for PR 29026 at commit [`3717fc6`](https://github.com/apache/spark/commit/3717fc618548d80464788d07a9b1f81f4418ed81).


----------------------------------------------------------------
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 #29026: [SPARK-28067][SPARK-32018] Fix decimal overflow issues

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






----------------------------------------------------------------
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 #29026: [SPARK-28067][SPARK-32018] fix decimal overflow issues

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






----------------------------------------------------------------
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 #29026: [SPARK-28067][SPARK-32018] Fix decimal overflow issues

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


   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] cloud-fan commented on a change in pull request #29026: [SPARK-28067][SPARK-32018] Fix decimal overflow issues

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



##########
File path: sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/aggregate/Sum.scala
##########
@@ -58,39 +58,50 @@ case class Sum(child: Expression) extends DeclarativeAggregate with ImplicitCast
     case _ => DoubleType
   }
 
-  private lazy val sumDataType = resultType
-
-  private lazy val sum = AttributeReference("sum", sumDataType)()
+  private lazy val sum = AttributeReference("sum", resultType)()
 
   private lazy val isEmpty = AttributeReference("isEmpty", BooleanType, nullable = false)()
 
-  private lazy val zero = Literal.default(sumDataType)
+  private lazy val zero = Literal.default(resultType)
 
   override lazy val aggBufferAttributes = resultType match {
     case _: DecimalType => sum :: isEmpty :: Nil
     case _ => sum :: Nil
   }
 
   override lazy val initialValues: Seq[Expression] = resultType match {
-    case _: DecimalType => Seq(Literal(null, resultType), Literal(true, BooleanType))
+    case _: DecimalType => Seq(zero, Literal(true, BooleanType))
     case _ => Seq(Literal(null, resultType))
   }
 
   override lazy val updateExpressions: Seq[Expression] = {
-    if (child.nullable) {
-      val updateSumExpr = coalesce(coalesce(sum, zero) + child.cast(sumDataType), sum)
-      resultType match {
-        case _: DecimalType =>
-          Seq(updateSumExpr, isEmpty && child.isNull)
-        case _ => Seq(updateSumExpr)
-      }
-    } else {
-      val updateSumExpr = coalesce(sum, zero) + child.cast(sumDataType)
-      resultType match {
-        case _: DecimalType =>
-          Seq(updateSumExpr, Literal(false, BooleanType))
-        case _ => Seq(updateSumExpr)
-      }
+    resultType match {
+      case _: DecimalType =>
+        // For decimal type, the initial value of `sum` is 0. We need to keep `sum` unchanged if
+        // the input is null, as SUM function ignores null input. The `sum` can only be null if
+        // overflow happens under non-ansi mode.

Review comment:
       It's the `Add` expression, and it always respects the ansi mode, no matter it's in update or merge expression.
   
   This makes sense. If overflow happens, we will fail anyway. It's better to fail earlier to save resources.




----------------------------------------------------------------
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 #29026: [SPARK-28067][SPARK-32018] Fix decimal overflow issues

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


   Test FAILed.
   Refer to this link for build results (access rights to CI server needed): 
   https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/125302/
   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 #29026: [SPARK-28067][SPARK-32018] Fix decimal overflow issues

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






----------------------------------------------------------------
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 #29026: [SPARK-28067][SPARK-32018] fix decimal overflow issues

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


   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] SparkQA removed a comment on pull request #29026: [SPARK-28067][SPARK-32018] fix decimal overflow issues

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


   **[Test build #125235 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/125235/testReport)** for PR 29026 at commit [`3717fc6`](https://github.com/apache/spark/commit/3717fc618548d80464788d07a9b1f81f4418ed81).


----------------------------------------------------------------
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 #29026: [SPARK-28067][SPARK-32018] Fix decimal overflow issues

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


   +1


----------------------------------------------------------------
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 #29026: [SPARK-28067][SPARK-32018] Fix decimal overflow issues

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


   **[Test build #125292 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/125292/testReport)** for PR 29026 at commit [`3717fc6`](https://github.com/apache/spark/commit/3717fc618548d80464788d07a9b1f81f4418ed81).


----------------------------------------------------------------
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 #29026: [SPARK-28067][SPARK-32018] Fix decimal overflow issues

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


   **[Test build #125254 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/125254/testReport)** for PR 29026 at commit [`3717fc6`](https://github.com/apache/spark/commit/3717fc618548d80464788d07a9b1f81f4418ed81).


----------------------------------------------------------------
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 #29026: [SPARK-28067][SPARK-32018] Fix decimal overflow issues

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


   Test FAILed.
   Refer to this link for build results (access rights to CI server needed): 
   https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/125292/
   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] cloud-fan commented on pull request #29026: [SPARK-28067][SPARK-32018] Fix decimal overflow issues

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


   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] AmplabJenkins commented on pull request #29026: [SPARK-28067][SPARK-32018] Fix decimal overflow issues

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






----------------------------------------------------------------
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 #29026: [SPARK-28067][SPARK-32018] fix decimal overflow issues

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


   **[Test build #125254 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/125254/testReport)** for PR 29026 at commit [`3717fc6`](https://github.com/apache/spark/commit/3717fc618548d80464788d07a9b1f81f4418ed81).


----------------------------------------------------------------
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 #29026: [SPARK-28067][SPARK-32018] Fix decimal overflow issues

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


   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] cloud-fan commented on a change in pull request #29026: [SPARK-28067][SPARK-32018] Fix decimal overflow issues

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



##########
File path: sql/core/src/test/scala/org/apache/spark/sql/UnsafeRowSuite.scala
##########
@@ -178,4 +178,14 @@ class UnsafeRowSuite extends SparkFunSuite {
     // Makes sure hashCode on unsafe array won't crash
     unsafeRow.getArray(0).hashCode()
   }
+
+  test("SPARK-32018: setDecimal with overflowed value") {
+    val d1 = new Decimal().set(BigDecimal("10000000000000000000")).toPrecision(38, 18)
+    val row = InternalRow.apply(d1)
+    val unsafeRow = UnsafeProjection.create(Array[DataType](DecimalType(38, 18))).apply(row)
+    assert(unsafeRow.getDecimal(0, 38, 18) === d1)
+    val d2 = (d1 * Decimal(10)).toPrecision(39, 18)
+    unsafeRow.setDecimal(0, d2, 38)
+    assert(unsafeRow.getDecimal(0, 38, 18) === null)

Review comment:
       `UnsafeRow` is a low-level entity and doesn't respect ansi flag.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



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


[GitHub] [spark] SparkQA removed a comment on pull request #29026: [SPARK-28067][SPARK-32018] Fix decimal overflow issues

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


   **[Test build #125383 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/125383/testReport)** for PR 29026 at commit [`3717fc6`](https://github.com/apache/spark/commit/3717fc618548d80464788d07a9b1f81f4418ed81).


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



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


[GitHub] [spark] dongjoon-hyun commented on pull request #29026: [SPARK-28067][SPARK-32018] Fix decimal overflow issues

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


   It's a build time out during PySpark test.
   ```
   Build timed out (after 500 minutes). Marking the build as aborted.
   Build was aborted
   ```


----------------------------------------------------------------
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 #29026: [SPARK-28067][SPARK-32018] fix decimal overflow issues

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


   **[Test build #125235 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/125235/testReport)** for PR 29026 at commit [`3717fc6`](https://github.com/apache/spark/commit/3717fc618548d80464788d07a9b1f81f4418ed81).
    * 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 #29026: [SPARK-28067][SPARK-32018] Fix decimal overflow issues

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


   **[Test build #125383 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/125383/testReport)** for PR 29026 at commit [`3717fc6`](https://github.com/apache/spark/commit/3717fc618548d80464788d07a9b1f81f4418ed81).
    * 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 #29026: [SPARK-28067][SPARK-32018] fix decimal overflow issues

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






----------------------------------------------------------------
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 #29026: [SPARK-28067][SPARK-32018] fix decimal overflow issues

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


   Test FAILed.
   Refer to this link for build results (access rights to CI server needed): 
   https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/125235/
   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] cloud-fan commented on pull request #29026: [SPARK-28067][SPARK-32018] Fix decimal overflow issues

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


   > So now we have UnsafeRow.setDecimal silently returns a null for an overflowed decimal value in setDecimal, but getDecimal throws error. There is inconsistency here. Why is that ok?
   
   Correction: `UnsafeRow.setDecimal` returns void. This PR fixes `UnsafeRow.setDecimal` so that `getDecimal` can return null if the value is overflowed.
   
   > Earlier I think the decision was to not do the checking per row, but now dont we end up doing that in some of the cases
   
   Under ansi mode, you have to check overflow per-row, as it's done by the `Add` expression. This is not changed in this PR.


----------------------------------------------------------------
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 #29026: [SPARK-28067][SPARK-32018] Fix decimal overflow issues

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


   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 #29026: [SPARK-28067][SPARK-32018] Fix decimal overflow issues

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






----------------------------------------------------------------
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 #29026: [SPARK-28067][SPARK-32018] Fix decimal overflow issues

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


   Test FAILed.
   Refer to this link for build results (access rights to CI server needed): 
   https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/125315/
   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 #29026: [SPARK-28067][SPARK-32018] Fix decimal overflow issues

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






----------------------------------------------------------------
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 #29026: [SPARK-28067][SPARK-32018] Fix decimal overflow issues

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






----------------------------------------------------------------
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 #29026: [SPARK-28067][SPARK-32018] Fix decimal overflow issues

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






----------------------------------------------------------------
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 #29026: [SPARK-28067][SPARK-32018] Fix decimal overflow issues

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



##########
File path: sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/aggregate/Sum.scala
##########
@@ -58,39 +58,50 @@ case class Sum(child: Expression) extends DeclarativeAggregate with ImplicitCast
     case _ => DoubleType
   }
 
-  private lazy val sumDataType = resultType
-
-  private lazy val sum = AttributeReference("sum", sumDataType)()
+  private lazy val sum = AttributeReference("sum", resultType)()
 
   private lazy val isEmpty = AttributeReference("isEmpty", BooleanType, nullable = false)()
 
-  private lazy val zero = Literal.default(sumDataType)
+  private lazy val zero = Literal.default(resultType)
 
   override lazy val aggBufferAttributes = resultType match {
     case _: DecimalType => sum :: isEmpty :: Nil
     case _ => sum :: Nil
   }
 
   override lazy val initialValues: Seq[Expression] = resultType match {
-    case _: DecimalType => Seq(Literal(null, resultType), Literal(true, BooleanType))
+    case _: DecimalType => Seq(zero, Literal(true, BooleanType))
     case _ => Seq(Literal(null, resultType))
   }
 
   override lazy val updateExpressions: Seq[Expression] = {
-    if (child.nullable) {
-      val updateSumExpr = coalesce(coalesce(sum, zero) + child.cast(sumDataType), sum)
-      resultType match {
-        case _: DecimalType =>
-          Seq(updateSumExpr, isEmpty && child.isNull)
-        case _ => Seq(updateSumExpr)
-      }
-    } else {
-      val updateSumExpr = coalesce(sum, zero) + child.cast(sumDataType)
-      resultType match {
-        case _: DecimalType =>
-          Seq(updateSumExpr, Literal(false, BooleanType))
-        case _ => Seq(updateSumExpr)
-      }
+    resultType match {
+      case _: DecimalType =>
+        // For decimal type, the initial value of `sum` is 0. We need to keep `sum` unchanged if
+        // the input is null, as SUM function ignores null input. The `sum` can only be null if
+        // overflow happens under non-ansi mode.

Review comment:
       Do you mean `checkOverflow` in `Add` expression? If it is enabled, for `DecimalType`, `DecimalExactNumeric` is used for `plus` operation. But I don't see it has overrided `plus` behavior to check overflow.




----------------------------------------------------------------
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 #29026: [SPARK-28067][SPARK-32018] Fix decimal overflow issues

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






----------------------------------------------------------------
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 #29026: [SPARK-28067][SPARK-32018] fix decimal overflow issues

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






----------------------------------------------------------------
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 #29026: [SPARK-28067][SPARK-32018] Fix decimal overflow issues

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


   Test FAILed.
   Refer to this link for build results (access rights to CI server needed): 
   https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/125301/
   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 #29026: [SPARK-28067][SPARK-32018] Fix decimal overflow issues

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


   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] HyukjinKwon closed pull request #29026: [SPARK-28067][SPARK-32018] Fix decimal overflow issues

Posted by GitBox <gi...@apache.org>.
HyukjinKwon closed pull request #29026:
URL: https://github.com/apache/spark/pull/29026


   


----------------------------------------------------------------
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 #29026: [SPARK-28067][SPARK-32018] Fix decimal overflow issues

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


   **[Test build #125315 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/125315/testReport)** for PR 29026 at commit [`3717fc6`](https://github.com/apache/spark/commit/3717fc618548d80464788d07a9b1f81f4418ed81).


----------------------------------------------------------------
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 #29026: [SPARK-28067][SPARK-32018] Fix decimal overflow issues

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






----------------------------------------------------------------
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 #29026: [SPARK-28067][SPARK-32018] Fix decimal overflow issues

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


   Hi, @anuragmantri, which part? Have you checked that discussion in the jira? e.g., https://issues.apache.org/jira/browse/SPARK-32018?focusedCommentId=17179002&page=com.atlassian.jira.plugin.system.issuetabpanels%3Acomment-tabpanel#comment-17179002


----------------------------------------------------------------
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] anuragmantri commented on pull request #29026: [SPARK-28067][SPARK-32018] Fix decimal overflow issues

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


   @cloud-fan @dongjoon-hyun - This PR (at least part of it) seems relevant to branch-2.4. Has there been a backport PR for this? If not, I would like to start a backport PR.


----------------------------------------------------------------
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 #29026: [SPARK-28067][SPARK-32018] fix decimal overflow issues

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


   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