当前位置:网站首页>Based on the open source stream batch integrated data synchronization engine Chunjun data restore DDL parsing module actual combat sharing
Based on the open source stream batch integrated data synchronization engine Chunjun data restore DDL parsing module actual combat sharing
2022-06-30 20:35:00 【Kangaroo cloud number stack dtinsight】
Link to the original text : Based on the open source stream batch integrated data synchronization engine ChunJun Data restore —DDL Share the actual combat of the analysis module
Courseware acquisition : Official account ** “ Several stack Study Club ”, Backstage private message “ChunJun”** Get live courseware
Video playback : Click here
ChunJun Open source project address :github 丨 gitee Like our project, give us a STAR!STAR!!STAR!!!( Important things are to be repeated for 3 times )
One 、ChunJun-DDL Introduction to the parsing module
In the last issue, we introduced 《ChunJun Support heterogeneous data sources DDL Conversion and automatic execution 》, Among them the Calcite analysis DDL The actual combat content is briefly introduced , In this issue, we will share this part in detail . It's going on DDL Before actual demonstration , Let's first review data restore and DDL Parse the contents of the module .
1、 Introduction to data restore
ChunJun Support mysql oracle postgresql sqlserver And other data sources are synchronized in real time , But the data after synchronization is output in the form of log , On this basis, data restoration can make the changes of source data change correspondingly in the target table , contain DML as well as DDL The corresponding operations will be performed in the target table , Ensure that the source table and target table schema Agreement 、 The data is consistent .
stay ChunJun There are also two scenarios for data restore in : Manual and automatic execution , The difference between them is ChunJun Can you parse Source End DDL Statement and convert to the downstream syntax corresponding statement , At the same time, the downstream will execute the corresponding DDL.
2、DDL Introduction to the parsing module
Because different data sources have different syntax , Execute in the heterogeneous data source scenario of data restore DDL Is a problem , How to integrate Source Of DDL Statement is converted to conform to Sink The grammatical DDL sentence , It has become a problem that puzzles many people ,ChunJun Also faced with such a dilemma , To solve the problem ,ChunJun Introduced DDL The parsing module solves this problem .
DDL The parsing module mainly solves 2 A question
analysis Source Of SQL, Turn it into ChunJun Extracted public entity classes
The public entity class is divided into Sink The syntax rule of the end is changed to the corresponding SQL

about SQL Convert this part , We added a DDL Convent Interface , This interface provides SQL Convert to public entity class and public entity class back to SQL The function of , The specific conversion will be implemented by the corresponding data source plug-ins according to their respective syntax .

DDL Data It is a top-level abstract class of public layer data that we extract , Because the syntax rules of each data source are different , So we need to extract a common layer , This common layer is used to convert data between different data sources .

To analyze SQL And turn it into public layer data , We introduced Calcite Conduct SQL Parsing , Different data sources will have corresponding SQL Parser , Through this parser SQL Parsing , take SQL The statement changes to the corresponding SQLNode, then SQLNode The information in is transferred to the middle tier .
In this way, we have solved the problem of DDL Grammatical inconsistencies .
Two 、ChunJun-DDL Analysis module practice
In the last chapter, we introduced some basic concepts , Next, let's show you how to operate .
- First step
stay ChunJun-SQL module Next , perform mvn clean compile -DskipTest,maven Will be packaged based on Calcite Implemented parser , Various data sources DDL The parsing module will generate the corresponding parser for SQL Parsing .

- The second step
The generated parser supports parsed SQL Syntax can see the corresponding module test modular .
- Concrete demonstration
The actual demonstration process will not be reviewed on the official account , Community partners can go to B Check the live review video on the website .
B Station live review address :
https://www.bilibili.com/video/BV1M3411w7S3?spm_id_from=333.999.0.0
3、 ... and 、Calcite stay ChunJun-DDL Practical application in
We introduce Calcite Conduct SQL Parsing , In the last chapter, we discussed ChunJun-DDL The analysis module is demonstrated in practice , Now let's share Calcite stay ChunJun-DDL Practical application in .
- First step
Mavne rely on , concrete ChunJun-DDL-MySQL Module Of pom To configure .
- The second step
Main Add the corresponding Codegen Folder , It is mainly composed of config.fmpp(Calcite Configuration file for ) and FTL The grammar file consists of .
- The third step
Write according to the data source syntax FTL file

Calcite Use Javacc As a grammar parser , And use Freemarker As a template engine , At compile time ,Freemarker The profile 、 Template syntax file 、 Attach the template file to generate the final syntax file as a whole , And pass JavaCC compile , formation Calcite The grammar file of .
- Concrete demonstration
The actual demonstration process will not be reviewed on the official account , Community partners can go to B Check the live review video on the website .
B Station live review address :
https://www.bilibili.com/video/BV1M3411w7S3?spm_id_from=333.999.0.0
Kangaroo cloud open source framework nail technology exchange group (30537511), Students interested in big data open source projects are welcome to join us to exchange the latest technical information , Open source project library address :https://github.com/DTStack
边栏推荐
- Torchdrug -- drug attribute prediction
- Build document editor based on slate
- Jerry's long press reset [chapter]
- Is it safe to open an account for online stock trading!?
- Jenkins can't pull the latest jar package
- 哈夫曼树(一)基本概念与C语言实现
- 以全栈全功能解决方案,应对多样工具复杂环境DevOps落地难题
- originpro 2021 附安装教程
- Why must we move from Devops to bizdevops?
- 杰理之关于长按开机检测抬起问题【篇】
猜你喜欢

Jenkins can't pull the latest jar package

大神詳解開源 BUFF 增益攻略丨直播
![Jerry's touch key recognition process [chapter]](/img/a4/3affa0f03db158ab68f69f935945e0.png)
Jerry's touch key recognition process [chapter]

A complete collection of vulnerability scanning tools. Mom doesn't have to worry that I won't find any more vulnerabilities

谈谈内联函数

昨晚 Spark Summit 重要功能发布全在这里(附超清视频)
![Jerry's touch key recognition process [chapter]](/img/ec/25d2d6fd26571e4fb642129a4eee1b.png)
Jerry's touch key recognition process [chapter]

SQL优化

AVL平衡二叉树(一) - 概念与C语言实现

GeoServer installation
随机推荐
AVL balanced binary tree (I) - concept and C language implementation
Go language identifier and package name specification
分析超700万个研发需求发现,这八大编程语言才是行业最需要的
NLP技能树学习路线-(一)路线总览
网上炒股开户安全嘛!?
Summary of operating system interview questions (updated from time to time)
By analyzing more than 7million R & D needs, it is found that these eight programming languages are the most needed by the industry
GeoServer installation
Why must we move from Devops to bizdevops?
HeartBeat基于CRM使用NFS对MySQL高可用
DEX file parsing - Method_ IDS resolution
Heartbeat 与DRBD 配置过程
Jerry's determination of detection sensitivity level [chapter]
Jerry's touch key recognition process [chapter]
Build document editor based on slate
MySQL master-slave synchronization
CADD course learning (1) -- basic knowledge of drug design
杰理之触摸按键识别流程【篇】
Openfire在使用MySQL数据库后的中文乱码问题解决
亚马逊在阿拉伯联合酋长国限制LGBTQ相关的搜索和产品销售