Flink SQL csv格式分隔符设置失败

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Flink SQL csv格式分隔符设置失败

gimlee
Flink 版本:1.11.1
我的flink sql:
create table stream_tmp.t1(
  log string) with (
  'connector' = 'kafka',
  'topic' = 't1',
  'properties.bootstrap.servers' = 'xxxxx:9092',
  'properties.group.id' = 'flink_test_01',
  'scan.startup.mode' = 'latest-offset',
  'format' = 'csv',
  'csv.field-delimiter' =  '\n'

);
提交到flink sql执行引擎中(获取sql,执行sql内容),报不认识'\n',内容如下:
Caused by: org.apache.flink.table.api.ValidationException: Option
'csv.field-delimiter' must be a string with single character, but was: \n
        at
org.apache.flink.formats.csv.CsvFormatFactory.validateCharacterVal(CsvFormatFactory.java:183)
        at
org.apache.flink.formats.csv.CsvFormatFactory.validateFormatOptions(CsvFormatFactory.java:158)
        at
org.apache.flink.formats.csv.CsvFormatFactory.createDecodingFormat(CsvFormatFactory.java:70)
        at
org.apache.flink.table.factories.FactoryUtil$TableFactoryHelper.lambda$discoverOptionalDecodingFormat$1(FactoryUtil.java:430)
        ... 42 common frames omitted

不明白为什么把'\n'识别成两个字符了





--
Sent from: http://apache-flink.147419.n8.nabble.com/
Reply | Threaded
Open this post in threaded view
|

Re: Flink SQL csv格式分隔符设置失败

JasonLee
hi

改成下面这样:

\n => U&'\000A'  

\t => U&'\0009'



-----
Best Wishes
JasonLee
--
Sent from: http://apache-flink.147419.n8.nabble.com/
Best Wishes
JasonLee