当前位置:网站首页>(4) Flink's table API and SQL table schema
(4) Flink's table API and SQL table schema
2022-07-02 15:35:00 【wx5ba7ab4695f27】
List of articles
table schema Defined Flink Table The data table structure of , Include field names , type , meanwhile Table Schema Hui He Table Format Match , stay Table Data input or output process Schema Transformation
But when Table Input/Output Format and Table Schema When they disagree , All need corresponding Mapping Relationship to map
Be careful : Users must follow Input/Output The order of fields in the data source TableSchema
withSchema(
new Schema()
.field("id",Types.INT)
.field("id",Types.STRING)
)
- 1.
- 2.
- 3.
- 4.
- 5.
In addition to creating Table Schema When specifying the name and type , Supported by proctime and rowtime And other methods to obtain the time attribute in the external data , among proctime Method does not need to pass parameters ,rowtime You need to define the time field and watermark Generative logic , At the same time, you can also use from Method maps from the dataset by name Table Schema Field information
.withSchema(
new Schema()
.field("Field",Types.INT)
.proctime()
.field("f2",Types.STRING)
.rowtime(...)
.field("f3",Types.STRING)
.from("origin_field_name")
)
- 1.
- 2.
- 3.
- 4.
- 5.
- 6.
- 7.
- 8.
- 9.
If Table API be based on Event Time Time concept processing data , You need to generate time in the access data Rowtime Information , as well as Watermark The generative logic of
.rowtime(
// You can extract from the input data according to the field name
new Rowtime().timestampsFromField("ts_filed")
// Or from the bottom DataStream API From , The data source needs to support the allocation of timestamps ( Such as Kafka 0.10X)
new Rowtime().timestampsFromSource()
// Or through customization timestampsFromSource extract Rowtime
new Rowtime().timestampsFromExtractor()
- 1.
- 2.
- 3.
- 4.
- 5.
- 6.
- 7.
Immediately after Rowtime() After the object instance, you need to specify Watermark Strategy
.rowtime(
// Time delay 2s Generate watermark
new Rowtime().watermarksPeriodicBounded(2000)
// and rowtime The maximum time is consistent
new Rowtime().watermarksPeriodicAscending()
// Use the bottom layer DataStream API The built-in Watermark
new Rowtime().watermarksFromSource()
)
- 1.
- 2.
- 3.
- 4.
- 5.
- 6.
- 7.
- 8.
边栏推荐
- 高考录取分数线爬取
- Loss function and positive and negative sample allocation: Yolo series
- 05_ queue
- 20_ Redis_ Sentinel mode
- MySQL calculate n-day retention rate
- Evaluation of embedded rz/g2l processor core board and development board of Feiling
- 03_ Linear table_ Linked list
- Engineer evaluation | rk3568 development board hands-on test
- Yolov5 code reproduction and server operation
- 百变大7座,五菱佳辰产品力出众,人性化大空间,关键价格真香
猜你喜欢
14_ Redis_ Optimistic lock
Redux——详解
Application and practice of Jenkins pipeline
做好抗“疫”之路的把关人——基于RK3568的红外热成像体温检测系统
LeetCode刷题——奇偶链表#328#Medium
Data analysis thinking analysis methods and business knowledge - business indicators
Beijing rental data analysis
YOLOV5 代码复现以及搭载服务器运行
Map introduction
14_Redis_乐观锁
随机推荐
面对“缺芯”挑战,飞凌如何为客户产能提供稳定强大的保障?
【LeetCode】876-链表的中间结点
LeetCode_ String_ Simple_ 412.Fizz Buzz
19_ Redis_ Manually configure the host after downtime
21_Redis_浅析Redis缓存穿透和雪崩
【Leetcode】167-两数之和II -输入有序数组
04. Some thoughts on enterprise application construction after entering cloud native
5. Practice: jctree implements the annotation processor at compile time
搭建自己的语义分割平台deeplabV3+
LeetCode刷题——两整数之和#371#Medium
12_ Redis_ Bitmap_ command
MySQL -- Index Optimization -- order by
Evaluation of embedded rz/g2l processor core board and development board of Feiling
16_Redis_Redis持久化
4. Data splitting of Flink real-time project
Leetcode skimming -- sum of two integers 371 medium
How does the computer set up speakers to play microphone sound
【LeetCode】1162-地图分析
Practice of compiling principle course -- implementing an interpreter or compiler of elementary function operation language
11_ Redis_ Hyperloglog_ command