配置后报错误 , 'format.ignore-parse-errors' = 'true' 这个参数需要怎么配置呢? The matching candidates: org.apache.flink.formats.json.JsonRowFormatFactory Unsupported property keys: format.ignore-parse-errors WITH ( ...... 'format.type' = 'json', 'format.ignore-parse-errors' = 'true', .... )
发件人: Leonard Xu 发送时间: 2020-04-22 12:18 收件人: user-zh; 王双利 主题: Re: json中date类型解析失败 Hi, flink支持的json format是遵循RFC标准[1]的,不支持从long型转化为json timestamp, json的 tiemstamp类型转化可以简单参考下,这个虽然符合标准,单对用户习惯来说确实不友好,目前社区也有一个jira[2]在跟进这个问题了。关于鲁棒性的问题,json format有个参数支持跳过解析错误的记录,'format.ignore-parse-errors' = 'true' ``` Long time = System.currentTimeMillis(); DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'"); Date date = new Date(time); String jsonSchemaDate = dateFormat.format(date); ``` [1] https://json-schema.org/understanding-json-schema/reference/string.html#dates-and-times [2] https://issues.apache.org/jira/browse/FLINK-16725 <https://issues.apache.org/jira/browse/FLINK-16725> Best, Leonard Xu > 在 2020年4月22日,12:05,王双利 <all...@163.com> 写道: > > 使用 flink-json -1.10.0 解析json数据报下面的错误 > > Caused by: java.time.format.DateTimeParseException: Text '1587527019680' > could not be parsed at index 0 > > 经检查 是 以下字段导致的 > {"jnlno":"e4574cce-8c9f-4d3f-974f-fc15250ec10d","ip":"122.96.41.218","channel":"pc","transdate":1587527019680,"event":"login","userid":"9","deviceid":"111111","taskid":"1","retcode":"000000","status":"fail"} > > 其中 transdate 是使用fastjson序列化得来的 > request.put("transdate",cal.getTime());JSON.toJSONString(request),解析失败后,系统直接停止,这个觉得也不太好吧,鲁棒性不够,万一其他系统发送一个错误格式的,系统直接挂掉,感觉不太合理。 > 以上的应该怎么解决才合适。 > >