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

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

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

Shang Yuanchun (Jira)
Jun Zhang created FLINK-14739:
---------------------------------

             Summary: 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
             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)