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

sepuri sai krishna commented on FLINK-41728:
--------------------------------------------

I would like to work on this and discuss the approach here before opening a PR. 
Could someone assign it to me?

> COLLECT counts equal BINARY and VARBINARY values as separate entries
> --------------------------------------------------------------------
>
>                 Key: FLINK-41728
>                 URL: https://issues.apache.org/jira/browse/FLINK-41728
>             Project: Flink
>          Issue Type: Bug
>          Components: Table SQL / Runtime
>    Affects Versions: 2.2.0, 2.3.0, 2.1.3
>            Reporter: sepuri sai krishna
>            Priority: Major
>
> {{COLLECT}} on a {{BINARY}} or {{VARBINARY}} value counts equal values 
> separately: each row adds its own entry instead of raising the count of the 
> existing one. This happens in batch mode, and in streaming mode with the 
> {{hashmap}} state backend. The same queries on {{STRING}} are correct, and 
> streaming with the {{rocksdb}} state backend is correct too.
> {code:sql}
> SET 'parallelism.default' = '1';
> CREATE TABLE src (k INT) WITH (
>   'connector' = 'datagen', 'number-of-rows' = '3',
>   'fields.k.kind' = 'sequence', 'fields.k.start' = '1', 'fields.k.end' = '3');
> SELECT COLLECT(CAST(CAST(MOD(k, 2) AS STRING) AS BYTES)) FROM src;
> SELECT COLLECT(CAST(MOD(k, 2) AS STRING)) FROM src;
> {code}
> ||Query||Result||
> |{{COLLECT}} on {{STRING}}|\{0=1, 1=2\}|
> |{{COLLECT}} on {{BYTES}}|\{x'30'=1, x'31'=1, x'31'=1\}|
> With an updating input, a retracted {{BYTES}} value is not removed either: 
> the result gets a second entry for it with count -1.
> Reproduced on 2.1.3, 2.2.0, 2.3.0 and master.



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

Reply via email to