[
https://issues.apache.org/jira/browse/FLINK-41320?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18137310#comment-18137310
]
sepuri sai krishna edited comment on FLINK-41320 at 11/4/26, 10:46 AM:
-----------------------------------------------------------------------
I would like to work on this. Could it be assigned to me?
was (Author: JIRAUSER313785):
I have a fix and tests for this locally. Please assign it to me and I will open
a PR.
> CAST of ARRAY, ROW or MAP to CHAR/VARCHAR(n) returns fewer than n characters
> and can insert a '?'
> -------------------------------------------------------------------------------------------------
>
> Key: FLINK-41320
> URL: https://issues.apache.org/jira/browse/FLINK-41320
> Project: Flink
> Issue Type: Bug
> Components: Table SQL / Planner
> Affects Versions: 2.4.0
> Reporter: sepuri sai krishna
> Priority: Major
>
> Casting a constructed type to a bounded character type returns fewer
> characters than the target
> allows, and can return a character that was not in the input. The same cast
> on a string column is
> correct.
> {code:sql}
> -- s is a STRING column holding '𝕏𝕏𝕏', three characters outside the BMP
> SELECT CAST(s AS VARCHAR(2)), -- 𝕏𝕏, correct
> CAST(ARRAY[s] AS VARCHAR(2)), -- [?
> CHAR_LENGTH(CAST(ARRAY[s] AS VARCHAR(5))), -- 3
> CHAR_LENGTH(CAST(ARRAY[s] AS CHAR(9))) -- 6
> FROM t;
> {code}
> The rendered array is {{[𝕏𝕏𝕏]}}, five characters, so {{VARCHAR(5)}} should
> hold all of it and returns
> three. The {{?}} was not in the input. A {{CHAR(9)}} value should be nine
> characters.
> {{ROW}} and {{MAP}} sources behave the same way.
--
This message was sent by Atlassian Jira
(v10.3.26#10030026)