[jira] [Created] (FLINK-22174) `csv.quote-character` does not work for csv format when sink

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[jira] [Created] (FLINK-22174) `csv.quote-character` does not work for csv format when sink

Shang Yuanchun (Jira)
hehuiyuan created FLINK-22174:
---------------------------------

             Summary: `csv.quote-character`  does not  work for  csv format  when sink
                 Key: FLINK-22174
                 URL: https://issues.apache.org/jira/browse/FLINK-22174
             Project: Flink
          Issue Type: Bug
          Components: Formats (JSON, Avro, Parquet, ORC, SequenceFile)
            Reporter: hehuiyuan


{code:java}
CREATE TABLE kafkaTableSource (
    name string,
    age int,
    sex string,
    address string
) WITH (
    'connector' = 'kafka',
    'topic' = 'hehuiyuan1',
    'scan.startup.mode' = 'latest-offset',
    'properties.bootstrap.servers' = 'localhost:9092',
    'properties.client.id' = 'test-consumer-group',
    'properties.group.id' = 'test-consumer-group',
    'format' = 'csv',
    'csv.quote-character' = '*'
);

CREATE TABLE kafkaTableSink (
    name string,
    age int,
    sex string,
    address string
) WITH (
    'connector' = 'kafka',
    'topic' = 'hehuiyuan2',
    'properties.bootstrap.servers' = 'localhost:9092',
    'format' = 'csv',
    'csv.quote-character' = '#'
);

insert into kafkaTableSink select * from kafkaTableSource;

{code}
 

Test 1 :

Generate data for topic `hehuiyuan1`
{code:java}
>hehuiyuan,22,man,hengshui
>*hehuiyuan*,*22*,*man*,*hengshui*
>#hehuiyuan#,22,#man#,#hengshui#
>hehuiyuan,22,#man#,#hengshui#
>"hehuiyuan",22,#man#,#hengshui#
{code}
 

Result data for topic `hehuiyuan2`
{code:java}
>hehuiyuan,22,man,hengshui
>hehuiyuan,22,man,hengshui
>###hehuiyuan###,22,###man###,###hengshui###
>hehuiyuan,22,###man###,###hengshui###
>#"hehuiyuan"#,22,###man###,###hengshui###
{code}
I think the result shoule be ` #hehuiyuan#,22,#man#,#hengshui# ` for the first and second data.

 

Test 2:

Add Timestamp field:
{code:java}
CREATE TABLE kafkaTableSource (
    name string,
    age int,
    sex string,
    address string,
    dt timestamp(3)
) WITH (
{code}
Generate data for topic `hehuiyuan1`
{code:java}
>hehuiyuan,22,man,hengshui,2020-12-12 12:12:12
>hehuiyuan,22,man,hengshui,2020-12-16 10:00:00{code}
Result data for topic `hehuiyuan2`
{code:java}
>hehuiyuan,22,man,hengshui,#2020-12-12 12:12:12#
>hehuiyuan,22,man,hengshui,#2020-12-16 10:00:00#
{code}
 

 

 

 

 

 

 



--
This message was sent by Atlassian Jira
(v8.3.4#803005)