yaooqinn commented on a change in pull request #26995: [SPARK-30341][SQL] 
Overflow check for interval arithmetic operations
URL: https://github.com/apache/spark/pull/26995#discussion_r370438991
 
 

 ##########
 File path: sql/core/src/test/resources/sql-tests/results/interval.sql.out
 ##########
 @@ -1101,3 +1102,45 @@ select interval '1 ' day
 struct<INTERVAL '1 days':interval>
 -- !query 113 output
 1 days
+
+
+-- !query 114
+select -(a) from values (interval '-2147483648 months', interval '2147483647 
months') t(a, b)
+-- !query 114 schema
+struct<(- a):interval>
+-- !query 114 output
+-178956970 years -8 months
+
+
+-- !query 115
+select a - b from values (interval '-2147483648 months', interval '2147483647 
months') t(a, b)
+-- !query 115 schema
+struct<(a - b):interval>
+-- !query 115 output
+1 months
+
+
+-- !query 116
+select b + interval '1 month' from values (interval '-2147483648 months', 
interval '2147483647 months') t(a, b)
+-- !query 116 schema
+struct<(b + INTERVAL '1 months'):interval>
+-- !query 116 output
+-178956970 years -8 months
+
+
+-- !query 117
+select a * 1.1 from values (interval '-2147483648 months', interval 
'2147483647 months') t(a, b)
+-- !query 117 schema
+struct<>
+-- !query 117 output
+java.lang.ArithmeticException
+integer overflow
 
 Review comment:
   I am OK with your suggestion,but first let us also cc @cloud-fan

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

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

Reply via email to