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/04 13:52:53 UTC

[GitHub] [spark] maropu commented on a change in pull request #28821: [SPARK-31981][SQL] Keep TimestampType when taking an average of a Timestamp

maropu commented on a change in pull request #28821:
URL: https://github.com/apache/spark/pull/28821#discussion_r449775121



##########
File path: sql/core/src/test/resources/sql-tests/results/udf/udf-window.sql.out
##########
@@ -154,17 +154,17 @@ SELECT val_timestamp, udf(cate), avg(val_timestamp) OVER(PARTITION BY udf(cate)
 RANGE BETWEEN CURRENT ROW AND interval 23 days 4 hours FOLLOWING) FROM testData
 ORDER BY udf(cate), val_timestamp
 -- !query schema
-struct<val_timestamp:timestamp,CAST(udf(cast(cate as string)) AS STRING):string,avg(CAST(val_timestamp AS DOUBLE)) OVER (PARTITION BY CAST(udf(cast(cate as string)) AS STRING) ORDER BY val_timestamp ASC NULLS FIRST RANGE BETWEEN CURRENT ROW AND INTERVAL '23 days 4 hours' FOLLOWING):double>
+struct<val_timestamp:timestamp,CAST(udf(cast(cate as string)) AS STRING):string,avg(val_timestamp) OVER (PARTITION BY CAST(udf(cast(cate as string)) AS STRING) ORDER BY val_timestamp ASC NULLS FIRST RANGE BETWEEN CURRENT ROW AND INTERVAL '23 days 4 hours' FOLLOWING):timestamp>
 -- !query output
 NULL	NULL	NULL
-2017-07-31 17:00:00	NULL	1.5015456E9
-2017-07-31 17:00:00	a	1.5016970666666667E9
-2017-07-31 17:00:00	a	1.5016970666666667E9
-2017-08-05 23:13:20	a	1.502E9
-2020-12-30 16:00:00	a	1.6093728E9
-2017-07-31 17:00:00	b	1.5022728E9
-2017-08-17 13:00:00	b	1.503E9
-2020-12-30 16:00:00	b	1.6093728E9
+2017-07-31 17:00:00	NULL	2017-07-31 17:00:00
+2017-07-31 17:00:00	a	2017-08-02 11:04:26.666666
+2017-07-31 17:00:00	a	2017-08-02 11:04:26.666666
+2017-08-05 23:13:20	a	2017-08-05 23:13:20
+2020-12-30 16:00:00	a	2020-12-30 16:00:00
+2017-07-31 17:00:00	b	2017-08-09 03:00:00
+2017-08-17 13:00:00	b	2017-08-17 13:00:00
+2020-12-30 16:00:00	b	2020-12-30 16:00:00

Review comment:
       It seems Oracle cannot accept timestamp for average, too. Any other system supporting this behaivour?




----------------------------------------------------------------
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