In pr #30452, I modify the g4 sytax of the Oracle Merge statement and tried adding an SQL parse assert xml file. Because of the complexity of the Merge statement, writing the xml file takes a lot of time.
For many beginners, writing xml assertion files is a nightmare because they need to know what the expected segment is for each segment and then understand each of their attributes. Currently, there is a large community of developers involved in SQL parsing tasks, and if we can adjust the assertion logic of SQL parsing results, it will greatly save developers time.
Now, I can think of a way to provide a tool that can automatically generate XML files based on SQLStatment, then manually check whether the XML file meets our expectations, and then add the XML assertion file to the SQL parsing test. However, this tool can also be abused, for example: people use it without any human checks, which may also hide some parsing bugs.
So, I want to hear what you think, what are your good ways, and welcome to leave a comment on the issue. In addition, we can also refer to some excellent SQL parsing engines, such as: Calcite Parser, Druid Parser, to see how they do AST testing.
Feature Request
Is your feature request related to a problem?
30452
Describe the feature you would like.
In pr #30452, I modify the g4 sytax of the Oracle Merge statement and tried adding an SQL parse assert xml file. Because of the complexity of the Merge statement, writing the xml file takes a lot of time.
For many beginners, writing xml assertion files is a nightmare because they need to know what the expected segment is for each segment and then understand each of their attributes. Currently, there is a large community of developers involved in SQL parsing tasks, and if we can adjust the assertion logic of SQL parsing results, it will greatly save developers time.
Now, I can think of a way to provide a tool that can automatically generate XML files based on SQLStatment, then manually check whether the XML file meets our expectations, and then add the XML assertion file to the SQL parsing test. However, this tool can also be abused, for example: people use it without any human checks, which may also hide some parsing bugs.
So, I want to hear what you think, what are your good ways, and welcome to leave a comment on the issue. In addition, we can also refer to some excellent SQL parsing engines, such as: Calcite Parser, Druid Parser, to see how they do AST testing.