cloud-fan commented on a change in pull request #26325: [SPARK-29663][SQL]
Support sum with interval type values
URL: https://github.com/apache/spark/pull/26325#discussion_r341981036
##########
File path: sql/core/src/test/resources/sql-tests/inputs/group-by.sql
##########
@@ -162,3 +162,34 @@ SELECT count(*) FROM test_agg WHERE count(*) > 1L;
SELECT count(*) FROM test_agg WHERE count(*) + 1L > 1L;
SELECT count(*) FROM test_agg WHERE k = 1 or k = 2 or count(*) + 1L > 1L or
max(k) > 1;
+-- sum interval values
+-- null
+select sum(cast(v as interval)) from VALUES ('1 seconds'), ('2 seconds'),
(null) t(v) where v is null;
+
+-- empty set
+select sum(cast(v as interval)) from VALUES ('1 seconds'), ('2 seconds'),
(null) t(v) where 1=0;
+
+--
+select sum(cast(v as interval)) from VALUES ('1 seconds'), ('2 seconds'),
(null) t(v);
+select sum(cast(v as interval)) from VALUES ('-1 seconds'), ('2 seconds'),
(null) t(v);
+select sum(cast(v as interval)) from VALUES ('-1 seconds'), ('-2 seconds'),
(null) t(v);
+select sum(cast(v as interval)) from VALUES ('-1 weeks'), ('2 seconds'),
(null) t(v);
+
+--group by
Review comment:
one space after `--`
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]