[ 
https://issues.apache.org/jira/browse/FLINK-40214?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Qilong Wang updated FLINK-40214:
--------------------------------
    Description: 
`JSON_OBJECTAGG` produces incorrect JSON object keys when its key and value 
arguments reference the same input column.

The generated keys contain additional escaped quotation marks instead of 
preserving the original column values.

*Steps to Reproduce*

Run the following query:
{code:java}
SELECT JSON_OBJECTAGG(f0 VALUE f0)
FROM (VALUES ('A'), ('B')) AS T(f0); {code}
The issue can also be reproduced with a group window aggregation:
{code:java}
SELECT JSON_OBJECTAGG(f0 VALUE f0)
FROM T
GROUP BY TUMBLE(rowtime_col, INTERVAL '5' SECOND); {code}
*Expected Result*

{"A":"A","B":"B"}

*Actual Result*
The object keys contain additional escaped quotation marks, similar to:

{"\"A\"":"A","\"B\"":"B"}

*Impact*
The issue affects JSON_OBJECTAGG queries where the key and value use the same 
input column. It can occur in both regular and window aggregations, producing 
JSON objects with incorrect key names.

  was:
`JSON_OBJECTAGG` produces incorrect JSON object keys when its key and value 
arguments reference the same input column.

The generated keys contain additional escaped quotation marks instead of 
preserving the original column values.

## Steps to Reproduce

Run the following query:

SELECT JSON_OBJECTAGG(f0 VALUE f0)
FROM (VALUES ('A'), ('B')) AS T(f0);
The issue can also be reproduced with a group window aggregation:
SELECT JSON_OBJECTAGG(f0 VALUE f0)
FROM T
GROUP BY TUMBLE(rowtime_col, INTERVAL '5' SECOND);
Expected Result
{"A":"A","B":"B"}
Actual Result
The object keys contain additional escaped quotation marks, similar to:
{"\"A\"":"A","\"B\"":"B"}
Impact
The issue affects JSON_OBJECTAGG queries where the key and value use the same 
input column. It can occur in both regular and window aggregations, producing 
JSON objects with incorrect key names.


> JSON_OBJECTAGG produces incorrect keys when key and value use the same column
> -----------------------------------------------------------------------------
>
>                 Key: FLINK-40214
>                 URL: https://issues.apache.org/jira/browse/FLINK-40214
>             Project: Flink
>          Issue Type: Bug
>            Reporter: Qilong Wang
>            Priority: Major
>
> `JSON_OBJECTAGG` produces incorrect JSON object keys when its key and value 
> arguments reference the same input column.
> The generated keys contain additional escaped quotation marks instead of 
> preserving the original column values.
> *Steps to Reproduce*
> Run the following query:
> {code:java}
> SELECT JSON_OBJECTAGG(f0 VALUE f0)
> FROM (VALUES ('A'), ('B')) AS T(f0); {code}
> The issue can also be reproduced with a group window aggregation:
> {code:java}
> SELECT JSON_OBJECTAGG(f0 VALUE f0)
> FROM T
> GROUP BY TUMBLE(rowtime_col, INTERVAL '5' SECOND); {code}
> *Expected Result*
> {"A":"A","B":"B"}
> *Actual Result*
> The object keys contain additional escaped quotation marks, similar to:
> {"\"A\"":"A","\"B\"":"B"}
> *Impact*
> The issue affects JSON_OBJECTAGG queries where the key and value use the same 
> input column. It can occur in both regular and window aggregations, producing 
> JSON objects with incorrect key names.



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

Reply via email to