当前位置:网站首页>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-07-27 11:06:00 【Several stacks of 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
The source of the original :VX official account “ Several stack Study Club ” 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
边栏推荐
- The largest square of leetcode (violence solving and dynamic programming solving)
- How to create a.Net image with diagnostic tools
- Analysis of heterogeneous computing technology
- How to build a data index system is the most effective. It will take you a quick start from 0 to 1
- ECCV 2022 | 同时完成四项跟踪任务!Unicorn: 迈向目标跟踪的大统一
- ASP. Net core dependency injection journey: 1. Theoretical concepts
- Shock simulation of engine mounting system transient modal dynamic analysis and response spectrum analysis
- 招聘顶尖人才!旷视科技“MegEagle创视者计划”正式启动
- Influence of black and white pixel distribution on iteration times
- 深度解析:什么是Diffusion Model?
猜你喜欢

Record of a cross domain problem

Tdengine business ecosystem partner recruitment starts

Influence of black and white pixel distribution on iteration times

How to build a data index system is the most effective. From 0 to 1, we will take you a quick start - 02 live review

How to assemble a registry

招聘顶尖人才!旷视科技“MegEagle创视者计划”正式启动

Advanced operation of MySQL data table

Tcp/ip protocol

涌现与形态的局部差异和整体差异

ASP.NET Core依赖注入之旅:1.理论概念
随机推荐
Tree data conversion
图片中非0值的数量对分类的影响
The difference between scalar, vector, matrix and tensor in deep learning
Alibaba mailbox web login turn processing
Distributed block device replication: client
Use of pyquery
Record of a cross domain problem
Delete in MySQL: the difference between delete, drop and truncate
[brother hero July training] day 16: queue
ASP. Net core dependency injection journey: 1. Theoretical concepts
神经网络学习笔记
A few simple steps to realize the sharing network for industrial raspberry pie
Derive the detailed expansion of STO double center kinetic energy integral
Tensorflow notes - basic functions and concepts
如何组装一个注册中心
Deep analysis: what is diffusion model?
antd中table hover上去的背景色样式修改
Non progressive phenomena of entropy and morphology
开源项目丨Taier1.2版本发布,新增工作流、租户绑定简化等多项功能
Tdengine business ecosystem partner recruitment starts