当前位置:网站首页>Flink format series (1) -json
Flink format series (1) -json
2022-07-24 05:41:00 【sf_ www】
Flink Of json Format support read and write json Formatted data , Just specify 'format' = 'json', Let's say kafka For example .
CREATE TABLE teacher (
name STRING,
age INT,
title ROW<id INT, name STRING, level INT>,
addr STRING
) WITH (
'connector' = 'kafka',
'topic' = 'test_teacher_info',
'properties.bootstrap.servers' = 'localhost:9092',
'properties.group.id' = 'testGroup',
'format' = 'json',
'json.fail-on-missing-field' = 'false',
'json.ignore-parse-errors' = 'true'
)
Description of key configurations :
json.fail-on-missing-field: Is in the json Whether an error is reported when a field is missing
json.ignore-parse-errors: In parsing json Whether an error is reported in case of failure
Generally, there is no guarantee json Format , So the above two configurations are more important .
Because there is ROW and ARRAY、MAP Data type of , So you can parse complex nested json Format , adopt xx.xx To access internally nested json Field . For example, the above one can pass select title.name To visit title This one json Inside name value . For example, the data is :
{"name":"jack", "age":44, "title":{"id":1, "name":" associate professor ", "level": 3}, "addr":"xxxx1"}
{"name":"rose", "age":47, "title":{"id":1, "name":" associate professor ", "level": 2}, "addr":"xxxx2"}
Note here title Nesting of json The format of , Don't write "title":\"{\"id\":1, \"name\":\" associate professor \", \"level\": 3}\" This format , Otherwise, it will report a mistake , Cannot be TextNode Turn into ObjectNode.
Some instructions for use :
1)Json Each of the {} All need to use Row By type
2)Json Each of the [] All need to use Arrary By type
3) The subscript of an array is from 1 Not at the beginning 0
4)SQL When the field name in is a keyword , It needs to be decorated with backquotes for example :`timestamp`
5)select The field type and order in the statement must be consistent with the field type and order of the result table
json The type and flink sql Type correspondence
边栏推荐
- MySQL的分页你还在使劲的limit?
- haclabs: no_name(HL.ova)靶机渗透-Vulnhub
- Canvas Bezier Bezier curve
- Substrate 技术及生态5月大事记 | Square One 计划启动,波卡上线 XCM!
- Vulnhub funbox: rookie (funbox2) target penetration
- 数据仓库与数仓建模
- 如何强制卸载Google浏览器,不用担心Google打开为白板,亲测有效。
- Flink 并行度的理解(parallel)
- select_ Render small phenomena
- Variables and constants in C language
猜你喜欢

Analysis of Dao liquidity dual currency pledge mining development principle

自定义MVC 3.0

How to forcibly uninstall Google browser? Don't worry about Google opening as a whiteboard. It's effective for personal testing.
![利用流媒体将RSTP流转成WEB端播放(二)[可回看]](/img/b9/2c0e6eb19acaa2356ff49f6e272826.png)
利用流媒体将RSTP流转成WEB端播放(二)[可回看]

haclabs: no_ Name (hl.ova) target penetration vulnhub

盘点波卡生态潜力项目 | 跨链特性促进多赛道繁荣

mapboxgl + geoserver 配置本地地图教程

Inventory Poka ecological potential project | cross chain characteristics to promote the prosperity of multi track

Canvas - rotate

MySQL之CRUD
随机推荐
Whole station downloader recommendation
Flink 生产环境配置建议
响应式页面
【百度地图API】您所使用的地图JS API版本过低,已不再维护,为保证地图基本功能 正常使用,请尽快升级到最新版地图JS API
Insanity:1(Insanity-Hosting)靶机渗透 —Vulnhub
Flink 并行度的理解(parallel)
jsp标签02
音乐 NFT 为什么火了?Polkadot 或将成为发展音乐 NFT 的最佳选择
Review the whole process of the 5th Polkadot Hackathon entrepreneurship competition, and uncover the secrets of the winning projects!
7. Draw a Bezier curve on the screen and smooth the curve with anti aliasing technology.
PoS机制随机性解读,波卡的随机性原理如何运作?
如何强制卸载Google浏览器,不用担心Google打开为白板,亲测有效。
Flink state使用
达梦数据库_在使用过程中的需要注意的小事项
【奖励发放】OneOS专区首届征文活动评奖结果公布
达梦数据库_支持的表类型,用法,特性
Cess test online line! The first decentralized storage network to provide multiple application scenarios
How to forcibly uninstall Google browser? Don't worry about Google opening as a whiteboard. It's effective for personal testing.
微信小程序map的使用
达梦数据库_逻辑备份