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

zoucao commented on FLINK-25476:
--------------------------------

Hi, [~twalthr],Thank you for your reply, some users want to get the max string 
value in production, the string filed may consists of  character and number. 
Now,varchar type has been spported for min/max agg function, but char type is 
not. If the max/min field is specified as char type, or specified as a fixed 
string,like 'a', '0', '1', the exception will be thrown. If user want to use 
this, they must cast a char to varchar.

> CharType lost in the creation of MaxAggFunction & MinAggFunction
> ----------------------------------------------------------------
>
>                 Key: FLINK-25476
>                 URL: https://issues.apache.org/jira/browse/FLINK-25476
>             Project: Flink
>          Issue Type: Bug
>          Components: Table SQL / Planner
>    Affects Versions: 1.15.0
>            Reporter: zoucao
>            Priority: Major
>
> CharType lost in AggFunctionFactory#createMinAggFunction(Retract) and 
> AggFunctionFactory#createMaxAggFunction(Retract&nonRetract).
> If execute 
> {code:java}
> SELECT Max('a') ...
> {code}
>  , The following exception will throw.
> ----
> Caused by: org.apache.flink.table.api.TableException: Max aggregate function 
> does not support type: ''CHAR''.
> Please re-check the data type.
>       at 
> org.apache.flink.table.planner.plan.utils.AggFunctionFactory.createMaxAggFunction(AggFunctionFactory.scala:395)
>       at 
> org.apache.flink.table.planner.plan.utils.AggFunctionFactory.createAggFunction(AggFunctionFactory.scala:76)
>       at 
> org.apache.flink.table.planner.plan.utils.AggregateUtil$.$anonfun$transformToAggregateInfoList$1(AggregateUtil.scala:444)



--
This message was sent by Atlassian Jira
(v8.20.1#820001)

Reply via email to