Keyur Makwana
12/13/2023, 9:06 AMString sourceDDL =
"CREATE TABLE Log (\n" +
" a1 STRING,\n" +
" a2 INT\n" +
") WITH (\n" +
" 'connector' = 'kafka',\n" +
" 'topic' = 'source_topic',\n" +
" 'value.format' = 'json', " +
" 'properties.bootstrap.servers' = 'ip',\n" +
"'scan.startup.mode' = 'latest-offset','properties.auto.offset.reset' = 'latest'" +
")";
streamTableEnvironment.executeSql(sourceDDL);
Table table = streamTableEnvironment.sqlQuery("SELECT * FROM Log");
DataStreamRow rowDataStream = streamTableEnvironment.toDataStream(table);
rowDataStream.print();
Now when I try below log it is working fine for me
{
“a1":“asdf”,
“a2":1
}
But if there any datatype mismatch({“a1”“asdf”,“a2”[1]}) then program is failing, Do anyone have idea how to handle the exception while using Kafka connector in SQL/Table API?Keyur Makwana
12/13/2023, 9:22 AM'format' = 'json',
'json.ignore-parse-errors' = 'true'