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

Jun Zhang commented on FLINK-14739:
-----------------------------------

In the process of my development, I have found two kinds of errors for json 
format data. One is json parse error. It seems that there is already a related 
patch. Another error is this CastException, at this time, there is no error on 
parse json, but the cast is wrong, so I want to add a configuration so that the 
user can more accurately locate which exception caused the program failed. If 
it is 'ignoreOnError' the user will not be able to clearly locate the cause of 
the error. [~wind_ljy]

> add failOnCastException Configuration to Json FormatDescriptor
> --------------------------------------------------------------
>
>                 Key: FLINK-14739
>                 URL: https://issues.apache.org/jira/browse/FLINK-14739
>             Project: Flink
>          Issue Type: Bug
>          Components: Formats (JSON, Avro, Parquet, ORC, SequenceFile)
>    Affects Versions: 1.9.1
>            Reporter: Jun Zhang
>            Priority: Major
>             Fix For: 1.9.2
>
>
> When flink read data from kafka (format is json), the schema is defined, 
> similar to the following DDL
> {code:java}
> CREATE TABLE kafka_source (
>   intotime VARCHAR,
>   userinfo ROW<name VARCHAR,age int>
> ) WITH (
>    'connector.type' = 'kafka',
>    'format.type' = 'json',
>     .............
> )
> {code}
> But when flink encounters error data, such as the type of userinfo is a 
> string, the program will throw the following exception and then fail.
> {code:java}
> Caused by: java.lang.ClassCastException: 
> org.apache.flink.shaded.jackson2.com.fasterxml.jackson.databind.node.TextNode 
> cannot be cast to org.apache.flink.shaded.jackson2.com.fasterxml.jackson. 
> databind.node.ObjectNode
> {code}
> I want to find the wrong data and don't want the program to fail. So I want 
> to add a json configuration, just like 
> org.apache.flink.table.descriptors.Json#failOnMissingField, which allows the 
> user to configure.



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

Reply via email to