You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user-zh@flink.apache.org by gimlee <gi...@163.com> on 2021/01/22 02:47:32 UTC

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

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/

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

Posted by JasonLee <17...@163.com>.
hi

改成下面这样:

\n => U&'\000A'   

\t => U&'\0009'



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