Sergey Nuyanzin created FLINK-41384:
---------------------------------------
Summary: 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
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)