[
https://issues.apache.org/jira/browse/SPARK-28602?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Kent Yao resolved SPARK-28602.
------------------------------
Fix Version/s: 3.0.0
Target Version/s: 3.0.0
Resolution: Duplicate
> Recognize interval as a numeric type
> ------------------------------------
>
> Key: SPARK-28602
> URL: https://issues.apache.org/jira/browse/SPARK-28602
> Project: Spark
> Issue Type: Sub-task
> Components: SQL
> Affects Versions: 3.0.0
> Reporter: Dylan Guedes
> Priority: Major
> Fix For: 3.0.0
>
>
> Hello,
> Spark does not recognize `interval` type as a `numeric` one, which means that
> we can't use `interval` columns in aggregated functions. For instance, the
> following query works on PgSQL but does not work on Spark:
> {code:sql}SELECT i,AVG(cast(v as interval)) OVER (ORDER BY i ROWS BETWEEN
> CURRENT ROW AND UNBOUNDED FOLLOWING) FROM (VALUES(1,'1 sec'),(2,'2
> sec'),(3,NULL),(4,NULL)) t(i,v);{code}
> {code:sql}cannot resolve 'avg(CAST(`v` AS INTERVAL))' due to data type
> mismatch: function average requires numeric types, not interval; line 1 pos
> 9{code}
>
--
This message was sent by Atlassian Jira
(v8.3.4#803005)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]