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

Yuhao Bi commented on FLINK-25488:
----------------------------------

I've raised a PR.

> Using a pipe symbol as pair delimiter in STR_TO_MAP in combination with 
> concatenation results in broken output 
> ---------------------------------------------------------------------------------------------------------------
>
>                 Key: FLINK-25488
>                 URL: https://issues.apache.org/jira/browse/FLINK-25488
>             Project: Flink
>          Issue Type: Bug
>          Components: Table SQL / Planner
>    Affects Versions: 1.14.2
>            Reporter: Martijn Visser
>            Priority: Major
>              Labels: pull-request-available
>
> Reproducible using Flink Faker:
> {code:sql}
> -- Create source table
> CREATE TABLE `customers` (
>   `identifier` STRING,
>   `fullname` STRING,
>   `postal_address` STRING,
>   `residential_address` STRING
> ) WITH (
>   'connector' = 'faker',
>   'fields.identifier.expression' = '#{Internet.uuid}',
>   'fields.fullname.expression' = '#{Name.firstName} #{Name.lastName}',
>   'fields.postal_address.expression' = '#{Address.fullAddress}',
>   'fields.residential_address.expression' = '#{Address.fullAddress}',
>   'rows-per-second' = '1'
> );
> {code}
> {code:sql}
> -- Doesn't generate expected output
> SELECT 
>   `identifier`,
>   `fullname`,
>   STR_TO_MAP('postal_address:' || postal_address || '|residential_address:' 
> || residential_address,'|',':') AS `addresses`
> FROM `customers`;
> {code}
> Output will look like:
> {code:sql}
> {=, A=null, C=null, D=null, L=null, O=null, P=null, S=null, T=null, _=null,  
> =null, a=null, b=null, c=null, d=null, e=null, g=null, h=null, i=null, 
> ,=null, l=null, -=null, m=null, .=null, n=null, o=null, p=null, q=null, 
> 2=null, r=null, 3=null, s=null, 4=null, t=null, 5=null, u=null, 6=null, 
> v=null, 7=null, w=null, 8=null, 9=null, |=null}
> {code}
> When using:
> {code:sql}
> -- Output looks like expected when using a different separator 
> SELECT 
>   `identifier`,
>   `fullname`,
>   STR_TO_MAP('postal_address:' || postal_address || ';residential_address:' 
> || residential_address,';',':') AS `addresses`
> FROM `customers`;
> {code}
> The output looks as expected:
> {code:sql}
> {postal_address=6654 Chong Meadows, East Lupita, CT 51702-8560, 
> residential_address=Apt. 098 51845 Shields Fork, North Erikland, NV 10386}
> {code}



--
This message was sent by Atlassian Jira
(v8.20.1#820001)

Reply via email to