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

dalongliu commented on FLINK-30221:
-----------------------------------

[~martijnvisser] I know TRY_CAST will return a NULL when cast occur error, this 
is as expected. However, when we use SUM with TRY_CAST, if some elements in the 
given column can't convert to target type, the result is NULL, I think this is 
not as expected. For the following example:

Regarding column a STRING, it has the following values ['1', '2', 'abc', '4', 
'5'], we query the column by the sql  `SELECT  SUM(TRY_CAST(a as BIGINT))`, the 
result return by flink is NULL. IMO, although the value 'abc' can't be 
converted to BIGINT, the query result should be 12 instead of NULL. WDYT?

> Fix the bug of sum(try_cast(string as bigint)) return null when partial 
> elements can't convert to bigint
> --------------------------------------------------------------------------------------------------------
>
>                 Key: FLINK-30221
>                 URL: https://issues.apache.org/jira/browse/FLINK-30221
>             Project: Flink
>          Issue Type: Sub-task
>          Components: Table SQL / API, Table SQL / Runtime
>    Affects Versions: 1.17.0
>            Reporter: dalongliu
>            Priority: Major
>




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

Reply via email to