apache / apache/incubator-seata

[Summer 2021]Parse Postgre SQL by Antlr

Open
#3,753 2 comments 0 reactions 1 assignee Claimed by @Yuan-Zhuo View on GitHub
Summer2021
Dominant language
Java
Stars
26k
Forks
8.8k
Avg merge
1d 8h
Merged PRs (30d)
4

Description

# Background
Seata need to generate the before/after image base on SQL parser when business error occur. But now the SQL parser dependent on Druid, and Druid is a database connection pools even though user use other database connection pools(like Hikari).

# Target
Use Antlr parse Postgre SQL instead of Druid.

# Difficulty
Medium

# Mentor
@l81893521
[349071347@qq.com](mailto:349071347@qq.com)

# Output Requirements
* Finish the PostgreSqlLexer.g4 script.
* Finish the PostgreSqlParser.g4 script.
* Parse the SQL what is Seata support.

# Technical Requirements
* Familiar with Java programming language.
* Understand common design patterns
* Ability to read source code

————————————————————————

# 背景

由于Seata需要对业务的SQL进行解析,并生成镜像用于业务报错时进行回滚。目前在Postgre数据库的固定使用Druid作为SQL解析工具,但是由于Druid是一块数据库连接池管理工具,哪怕用户使用了其他连接池管理工具(如Hikari),也要强依赖Druid,实现不太优雅。

# 目标

使用Antlr语法分析器,解析SQL语法,解耦Druid的强依赖,只需要实现目前Seata支持的语法,无需实现所有语法。 目前已使用Antlr实现了MySQL语法解析,可参照其实现,实现Postgre 的语法解析。

# 难度
中等

# 导师
@l81893521
[349071347@qq.com](mailto:349071347@qq.com)

# 产出要求
* 完成PostgreSqlLexer.g4脚本编写
* 完成PostgreSqlParser.g4脚本编写
* 能成功解析SQL并整合到Seata里

# 能力要求
* 熟悉Java开发语言。
* 理解常见设计模式。
* 具备一定的源码阅读能力

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.