[ 
https://issues.apache.org/jira/browse/SPARK-58044?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18094647#comment-18094647
 ] 

Rakesh Raushan commented on SPARK-58044:
----------------------------------------

I am working on it

> Support TIME datatype in AVG()
> ------------------------------
>
>                 Key: SPARK-58044
>                 URL: https://issues.apache.org/jira/browse/SPARK-58044
>             Project: Spark
>          Issue Type: Sub-task
>          Components: SQL
>    Affects Versions: 4.3.0
>            Reporter: Rakesh Raushan
>            Priority: Major
>
> AVG() expects NumericType,YearMonthIntervalType and DayTimeIntervalType as 
> input. It throws error for Time datatype as it assumes Time datatype is not 
> quantifiable.
> Time is internally stored as a long value only which can be quantified and 
> average can be computed for time datatype as well.
> Other aggregate functions like min(), max(), percentile(), 
> approx_percentile(), etc are already supported.
>  
> Currently if a user wants to calculate average on time column, user has to 
> cast it to numeric type, calculate average and then cast back to time type.
> Supporting TIME datatype columns as native types in AVG() would allow users 
> to write cleaner and error free code.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to