You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by GitBox <gi...@apache.org> on 2022/03/02 05:54:35 UTC
[GitHub] [shardingsphere] tuichenchuxin opened a new issue #15746: [OpenForce 2022] support parsing Postgre sql `DROP FOREIGN TABLE`
tuichenchuxin opened a new issue #15746:
URL: https://github.com/apache/shardingsphere/issues/15746
Hi community,
This issue is for [OpenForce 2022](https://github.com/apache/shardingsphere/discussions/12683#discussioncomment-2139441)
## Background
ShardingSphere parser engine helps users parse a SQL to get the AST (Abstract Syntax Tree) and visit this tree to get SQLStatement (Java Object). At present, this parser engine can handle SQLs for `MySQL`, `PostgreSQL`, `SQLServer`, `openGauss` and `Oracle`, which means we have to understand different database dialect SQLs.
More details:
https://shardingsphere.apache.org/document/current/en/reference/sharding/parse/
## Task
This issue is to solve some of the unsupported postgres sqls in [this file](https://github.com/apache/shardingsphere/blob/master/shardingsphere-test/shardingsphere-parser-test/src/main/resources/sql/unsupported/unsupported.xml) .
- [ ] DROP FOREIGN TABLE
You can learn more details about this SQL [here](https://www.postgresql.org/docs/current/sql-commands.html).
- You may need to try to get why it's not supported.(antlr4 grammar? or not implement visit method) You can use [antlr4 plugins](https://plugins.jetbrains.com/plugin/7358-antlr-v4) to help you to analyze. You may need to visit [an official doc](https://www.postgresql.org/docs/current/sql-commands.html) to check the grammar.
- After you fix it, remember to add a new corresponding SQL case in [SQL Cases](https://github.com/apache/shardingsphere/tree/master/shardingsphere-test/shardingsphere-parser-test/src/main/resources/sql/supported) and expected parsed result in [Expected Statment XML](https://github.com/apache/shardingsphere/tree/master/shardingsphere-test/shardingsphere-parser-test/src/main/resources/case).
- Run [SQLParserParameterizedTest](https://github.com/apache/shardingsphere/blob/master/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/engine/SQLParserParameterizedTest.java) and [UnsupportedSQLParserParameterizedTest](https://github.com/apache/shardingsphere/blob/master/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/engine/UnsupportedSQLParserParameterizedTest.java) to make sure no exceptions.
Notice, these issues can be a good example.
[support alter foreign table for pg/og ](https://github.com/apache/shardingsphere/pull/14944)
[support alter materialized view for pg/og.](https://github.com/apache/shardingsphere/pull/15331)
## Relevant Skills
1. Master JAVA language
2. Have a basic understanding of Antlr g4 file
3. Be familiar with Postgres SQLs
## Targets files
1. Postgres SQLs g4 file: https://github.com/apache/shardingsphere/blob/master/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-postgresql/src/main/antlr4/org/apache/shardingsphere/sql/parser/autogen/PostgreSQLStatement.g4
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [shardingsphere] tuichenchuxin commented on issue #15746: [OpenForce 2022] support parsing Postgre sql `DROP FOREIGN TABLE`
Posted by GitBox <gi...@apache.org>.
tuichenchuxin commented on issue #15746:
URL: https://github.com/apache/shardingsphere/issues/15746#issuecomment-1065894213
@pk-218 Because `PostgreSQLStatementParser` grammar is the root grammar, And it's grammar logic is very clear. The error is because of different package. So we don't need to detected this file. And for this issue, I think we need to find whether shardingSphere has this grammar or not. And if had this grammar, then check out whether this rule is in `PostgreSQLStatementParser.g4` or not.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [shardingsphere] strongduanmu closed issue #15746: [OpenForce 2022] support parsing Postgre sql `DROP FOREIGN TABLE`
Posted by GitBox <gi...@apache.org>.
strongduanmu closed issue #15746:
URL: https://github.com/apache/shardingsphere/issues/15746
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [shardingsphere] pk-218 commented on issue #15746: [OpenForce 2022] support parsing Postgre sql `DROP FOREIGN TABLE`
Posted by GitBox <gi...@apache.org>.
pk-218 commented on issue #15746:
URL: https://github.com/apache/shardingsphere/issues/15746#issuecomment-1065099306
Hey @tuichenchuxin! I am contributing to OpenForce 2022 and would like to work on this issue. Could you assign it to me?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [shardingsphere] tuichenchuxin commented on issue #15746: [OpenForce 2022] support parsing Postgre sql `DROP FOREIGN TABLE`
Posted by GitBox <gi...@apache.org>.
tuichenchuxin commented on issue #15746:
URL: https://github.com/apache/shardingsphere/issues/15746#issuecomment-1065882264
@pk-218 This error needs no worry. Because of the antlr file is in different package, So the antlr plugin can't support.
Just need to detect the `TCLStatement`, `DCLStatement`, `DALStatement`, `StoreProcedure`.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [shardingsphere] pk-218 commented on issue #15746: [OpenForce 2022] support parsing Postgre sql `DROP FOREIGN TABLE`
Posted by GitBox <gi...@apache.org>.
pk-218 commented on issue #15746:
URL: https://github.com/apache/shardingsphere/issues/15746#issuecomment-1065858676
I am encountering the following error

```
error(110): /shardingsphere/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-postgresql/src/main/antlr4/org/apache/shardingsphere/sql/parser/autogen/PostgreSQLStatementLexer.g4:20:7: can't find or load grammar ModeLexer
```
The ANTLR plugin is unable to detect the `ModeLexer.g4` import from `src/main/antlr4/imports/postgresql` to `src/main/antlr4/org/apache/shardingsphere/sql/parser/autogen` for the `PostgreSQLStatementLexer` grammar.
The same issue arises for `PostgreSQLStatementParser.g4` where `TCLStatement`, `DCLStatement`, `DALStatement`, `StoreProcedure` grammars are not detected.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [shardingsphere] pk-218 commented on issue #15746: [OpenForce 2022] support parsing Postgre sql `DROP FOREIGN TABLE`
Posted by GitBox <gi...@apache.org>.
pk-218 commented on issue #15746:
URL: https://github.com/apache/shardingsphere/issues/15746#issuecomment-1065887296
@tuichenchuxin How do I make sure the grammars `TCLStatement`, `DCLStatement`, `DALStatement`, `StoreProcedure` are detected for `PostgreSQLStatementParser`? I am getting the same error in `PostgreSQLStatementParser.g4`.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [shardingsphere] strongduanmu commented on issue #15746: [OpenForce 2022] support parsing Postgre sql `DROP FOREIGN TABLE`
Posted by GitBox <gi...@apache.org>.
strongduanmu commented on issue #15746:
URL: https://github.com/apache/shardingsphere/issues/15746#issuecomment-1065729606
Welcome @pk-218, I will assign this issue to you.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [shardingsphere] pk-218 commented on issue #15746: [OpenForce 2022] support parsing Postgre sql `DROP FOREIGN TABLE`
Posted by GitBox <gi...@apache.org>.
pk-218 commented on issue #15746:
URL: https://github.com/apache/shardingsphere/issues/15746#issuecomment-1076319485
Hey @tuichenchuxin! I have made a PR #16312 for the issue. Can you review it?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org