You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by "Hequn Cheng (Jira)" <ji...@apache.org> on 2020/01/23 06:43:00 UTC

[jira] [Updated] (FLINK-14739) add failOnCastException Configuration to Json FormatDescriptor

     [ https://issues.apache.org/jira/browse/FLINK-14739?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Hequn Cheng updated FLINK-14739:
--------------------------------
    Fix Version/s:     (was: 1.9.2)
                   1.9.3

> 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.3
>
>
> 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)