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

Sergey Nuyanzin commented on FLINK-41384:
-----------------------------------------

Merged as 
[e4fe6ce2f146938556d2f0f950c88b170e7ef90e|https://github.com/apache/flink/commit/e4fe6ce2f146938556d2f0f950c88b170e7ef90e]

> Extra parse methods for JSON and XML functions in CASE branches
> ---------------------------------------------------------------
>
>                 Key: FLINK-41384
>                 URL: https://issues.apache.org/jira/browse/FLINK-41384
>             Project: Flink
>          Issue Type: Technical Debt
>          Components: Table SQL / Runtime
>            Reporter: Sergey Nuyanzin
>            Assignee: Sergey Nuyanzin
>            Priority: Major
>              Labels: pull-request-available
>
> Several JSON and XML functions on the same input share one parse method in 
> the generated code.
> This does not work inside {{CASE}}, {{OR}}, {{COALESCE}} when the input is an 
> expression, for example TRIM(j). The expression is generated again in each 
> branch. Each branch then gets its own parse method.
> {code:sql}
> SELECT CASE WHEN c1 THEN JSON_VALUE(TRIM(j), '$.a')
>             WHEN c2 THEN JSON_VALUE(TRIM(j), '$.b')
>             ELSE NULL END
> FROM t
> {code}
> The generated code has two identical parse methods instead of one.
> The result is correct. The generated code is just bigger than needed, and it 
> grows with every branch.



--
This message was sent by Atlassian Jira
(v10.3.26#10030026)

Reply via email to