You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by GitBox <gi...@apache.org> on 2021/03/26 09:06:14 UTC

[GitHub] [spark] AngersZhuuuu opened a new pull request #31971: [SPARK-34744][SQL] Improve error message for casting cause overflow eror

AngersZhuuuu opened a new pull request #31971:
URL: https://github.com/apache/spark/pull/31971


   
   ### What changes were proposed in this pull request?
   For example:
   ```
   set spark.sql.ansi.enabled=true;
   select tinyint(128) * tinyint(2);
   ```
   Error message before this pr:
   ```
   Casting 128 to scala.Byte$ causes overflow
   ```
   After this pr:
   ```
   Casting 128 to tinyint causes overflow
   We should use DataType's catalogString.
   ```
   
   ### Why are the changes needed?
   Improve error message
   
   ### Does this PR introduce _any_ user-facing change?
   No
   
   ### How was this patch tested?
   Exist UT


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

For queries about this service, please contact Infrastructure at:
users@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 #31971: [SPARK-34744][SQL] Improve error message for casting cause overflow error

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


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


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

For queries about this service, please contact Infrastructure at:
users@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 #31971: [SPARK-34744][SQL] Improve error message for casting cause overflow error

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


   **[Test build #136555 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/136555/testReport)** for PR 31971 at commit [`a06a6bd`](https://github.com/apache/spark/commit/a06a6bd8f84c6c2be80449dade43c77d3a604e76).


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

For queries about this service, please contact Infrastructure at:
users@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 #31971: [SPARK-34744][SQL] Improve error message for casting cause overflow error

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


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


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

For queries about this service, please contact Infrastructure at:
users@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 #31971: [SPARK-34744][SQL] Improve error message for casting cause overflow error

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


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


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

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



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


[GitHub] [spark] yaooqinn commented on a change in pull request #31971: [SPARK-34744][SQL] Improve error message for casting cause overflow error

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



##########
File path: sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/expressions/CastSuite.scala
##########
@@ -1698,10 +1698,18 @@ class CastSuite extends CastSuiteBase {
 
   test("SPARK-34744: Improve error message for casting cause overflow error") {
     withSQLConf(SQLConf.ANSI_ENABLED.key -> "true") {
-      val e = intercept[ArithmeticException] {
-        Cast(Literal(128), ByteType).eval()
+      val e1 = intercept[ArithmeticException] {
+        Cast(Literal(Byte.MaxValue.toInt + 1), ByteType).eval()
       }.getMessage
-      assert(e.contains("Casting 128 to tinyint causes overflow"))
+      assert(e1.contains("Casting 128 to tinyint causes overflow"))
+      val e2 = intercept[ArithmeticException] {
+        Cast(Literal(Short.MaxValue.toInt + 1), ShortType).eval()

Review comment:
       nit: redundant toInt




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

For queries about this service, please contact Infrastructure at:
users@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 #31971: [SPARK-34744][SQL] Improve error message for casting cause overflow error

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






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

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



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


[GitHub] [spark] AngersZhuuuu commented on pull request #31971: [SPARK-34744][SQL] Improve error message for casting cause overflow error

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


   > @AngersZhuuuu Could you change PR's description.
   > 
   > After this pr:
   > 
   > ```
   > Casting 128 to tinyint causes overflow
   > We should use DataType's catalogString.
   > ```
   > 
   > I guess `We should use DataType's catalogString.` is not a part of the error message.
   > 
   > And I would move the before and after examples to the section `Does this PR introduce any user-facing change?`. The error message is the things that users face to.
   
   Done, thanks.


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

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



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


[GitHub] [spark] AngersZhuuuu commented on a change in pull request #31971: [SPARK-34744][SQL] Improve error message for casting cause overflow error

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



##########
File path: sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/expressions/CastSuite.scala
##########
@@ -1698,10 +1698,18 @@ class CastSuite extends CastSuiteBase {
 
   test("SPARK-34744: Improve error message for casting cause overflow error") {
     withSQLConf(SQLConf.ANSI_ENABLED.key -> "true") {
-      val e = intercept[ArithmeticException] {
-        Cast(Literal(128), ByteType).eval()
+      val e1 = intercept[ArithmeticException] {
+        Cast(Literal(Byte.MaxValue.toInt + 1), ByteType).eval()
       }.getMessage
-      assert(e.contains("Casting 128 to tinyint causes overflow"))
+      assert(e1.contains("Casting 128 to tinyint causes overflow"))
+      val e2 = intercept[ArithmeticException] {
+        Cast(Literal(Short.MaxValue.toInt + 1), ShortType).eval()

Review comment:
       > nit: redundant toInt
   
   Done

##########
File path: sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/expressions/CastSuite.scala
##########
@@ -1698,10 +1698,18 @@ class CastSuite extends CastSuiteBase {
 
   test("SPARK-34744: Improve error message for casting cause overflow error") {
     withSQLConf(SQLConf.ANSI_ENABLED.key -> "true") {
-      val e = intercept[ArithmeticException] {
-        Cast(Literal(128), ByteType).eval()
+      val e1 = intercept[ArithmeticException] {
+        Cast(Literal(Byte.MaxValue.toInt + 1), ByteType).eval()
       }.getMessage
-      assert(e.contains("Casting 128 to tinyint causes overflow"))
+      assert(e1.contains("Casting 128 to tinyint causes overflow"))
+      val e2 = intercept[ArithmeticException] {
+        Cast(Literal(Short.MaxValue.toInt + 1), ShortType).eval()
+      }.getMessage
+      assert(e2.contains("Casting 32768 to smallint causes overflow"))
+      val e3 = intercept[ArithmeticException] {
+        Cast(Literal(Int.MaxValue.toLong + 1), IntegerType).eval()

Review comment:
       > nit:Int.MaxValue + 1L
   
   Done




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

For queries about this service, please contact Infrastructure at:
users@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 #31971: [SPARK-34744][SQL] Improve error message for casting cause overflow error

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


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


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

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



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


[GitHub] [spark] gengliangwang commented on a change in pull request #31971: [SPARK-34744][SQL] Improve error message for casting cause overflow error

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



##########
File path: sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/expressions/CastSuite.scala
##########
@@ -1695,6 +1695,15 @@ class CastSuite extends CastSuiteBase {
   test("SPARK-34727: cast from float II") {
     checkCast(16777215.0f, java.time.Instant.ofEpochSecond(16777215))
   }
+
+  test("SPARK-34744: Improve error message for casting cause overflow error") {
+    withSQLConf(SQLConf.ANSI_ENABLED.key -> "true") {
+      val e = intercept[ArithmeticException] {
+        Cast(Literal(128), ByteType).eval()

Review comment:
       Let's test all of Byte/Short/Int types.




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

For queries about this service, please contact Infrastructure at:
users@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 #31971: [SPARK-34744][SQL] Improve error message for casting cause overflow error

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


   **[Test build #136571 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/136571/testReport)** for PR 31971 at commit [`fc6fdcc`](https://github.com/apache/spark/commit/fc6fdcc06c394f59a859ddf2c65d854d6565a0b9).


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

For queries about this service, please contact Infrastructure at:
users@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 #31971: [SPARK-34744][SQL] Improve error message for casting cause overflow error

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


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


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

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



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


[GitHub] [spark] yaooqinn commented on pull request #31971: [SPARK-34744][SQL] Improve error message for casting cause overflow error

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


   thanks, 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 #31971: [SPARK-34744][SQL] Improve error message for casting cause overflow error

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


   **[Test build #136571 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/136571/testReport)** for PR 31971 at commit [`fc6fdcc`](https://github.com/apache/spark/commit/fc6fdcc06c394f59a859ddf2c65d854d6565a0b9).


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

For queries about this service, please contact Infrastructure at:
users@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 #31971: [SPARK-34744][SQL] Improve error message for casting cause overflow error

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


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


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

For queries about this service, please contact Infrastructure at:
users@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 #31971: [SPARK-34744][SQL] Improve error message for casting cause overflow error

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


   **[Test build #136555 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/136555/testReport)** for PR 31971 at commit [`a06a6bd`](https://github.com/apache/spark/commit/a06a6bd8f84c6c2be80449dade43c77d3a604e76).


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

For queries about this service, please contact Infrastructure at:
users@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 #31971: [SPARK-34744][SQL] Improve error message for casting cause overflow error

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


   **[Test build #136555 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/136555/testReport)** for PR 31971 at commit [`a06a6bd`](https://github.com/apache/spark/commit/a06a6bd8f84c6c2be80449dade43c77d3a604e76).
    * This patch **fails Spark unit tests**.
    * This patch merges cleanly.
    * This patch adds no public classes.


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

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



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


[GitHub] [spark] AmplabJenkins removed a comment on pull request #31971: [SPARK-34744][SQL] Improve error message for casting cause overflow error

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


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


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

For queries about this service, please contact Infrastructure at:
users@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 #31971: [SPARK-34744][SQL] Improve error message for casting cause overflow error

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


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


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

For queries about this service, please contact Infrastructure at:
users@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 #31971: [SPARK-34744][SQL] Improve error message for casting cause overflow error

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


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


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

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



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


[GitHub] [spark] AngersZhuuuu commented on a change in pull request #31971: [SPARK-34744][SQL] Improve error message for casting cause overflow error

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



##########
File path: sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/expressions/CastSuite.scala
##########
@@ -1695,6 +1695,15 @@ class CastSuite extends CastSuiteBase {
   test("SPARK-34727: cast from float II") {
     checkCast(16777215.0f, java.time.Instant.ofEpochSecond(16777215))
   }
+
+  test("SPARK-34744: Improve error message for casting cause overflow error") {
+    withSQLConf(SQLConf.ANSI_ENABLED.key -> "true") {
+      val e = intercept[ArithmeticException] {
+        Cast(Literal(128), ByteType).eval()

Review comment:
       > Let's test all of Byte/Short/Int types.
   
   Done




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

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



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


[GitHub] [spark] yaooqinn closed pull request #31971: [SPARK-34744][SQL] Improve error message for casting cause overflow error

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


   


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

For queries about this service, please contact Infrastructure at:
users@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 #31971: [SPARK-34744][SQL] Improve error message for casting cause overflow error

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


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


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

For queries about this service, please contact Infrastructure at:
users@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 #31971: [SPARK-34744][SQL] Improve error message for casting cause overflow error

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


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


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

For queries about this service, please contact Infrastructure at:
users@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 #31971: [SPARK-34744][SQL] Improve error message for casting cause overflow error

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


   **[Test build #136571 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/136571/testReport)** for PR 31971 at commit [`fc6fdcc`](https://github.com/apache/spark/commit/fc6fdcc06c394f59a859ddf2c65d854d6565a0b9).
    * 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 #31971: [SPARK-34744][SQL] Improve error message for casting cause overflow error

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






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

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



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


[GitHub] [spark] yaooqinn commented on a change in pull request #31971: [SPARK-34744][SQL] Improve error message for casting cause overflow error

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



##########
File path: sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/expressions/CastSuite.scala
##########
@@ -1698,10 +1698,18 @@ class CastSuite extends CastSuiteBase {
 
   test("SPARK-34744: Improve error message for casting cause overflow error") {
     withSQLConf(SQLConf.ANSI_ENABLED.key -> "true") {
-      val e = intercept[ArithmeticException] {
-        Cast(Literal(128), ByteType).eval()
+      val e1 = intercept[ArithmeticException] {
+        Cast(Literal(Byte.MaxValue.toInt + 1), ByteType).eval()
       }.getMessage
-      assert(e.contains("Casting 128 to tinyint causes overflow"))
+      assert(e1.contains("Casting 128 to tinyint causes overflow"))
+      val e2 = intercept[ArithmeticException] {
+        Cast(Literal(Short.MaxValue.toInt + 1), ShortType).eval()
+      }.getMessage
+      assert(e2.contains("Casting 32768 to smallint causes overflow"))
+      val e3 = intercept[ArithmeticException] {
+        Cast(Literal(Int.MaxValue.toLong + 1), IntegerType).eval()

Review comment:
       nit:Int.MaxValue + 1L




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

For queries about this service, please contact Infrastructure at:
users@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 #31971: [SPARK-34744][SQL] Improve error message for casting cause overflow error

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


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


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

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



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