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/10/09 04:45:16 UTC

[GitHub] [shardingsphere] jingshanglu opened a new issue, #6478: [SQL Definition Collation][SQLServer]Collate the g4 files of SQL definitions

jingshanglu opened a new issue, #6478:
URL: https://github.com/apache/shardingsphere/issues/6478

   Hi community,
   
   This issue is to collate the SQL definitions of SQLServer. **Therefore, we can support parsing more SQLs**. 
   We need your interaction! If you 
   
   > 1. Be familiar with `g4 file` of Antlr (The grammars are RegularExpression-like)
   > 2. Understand the `SQLServer grammars`
   
   then welcome!
   
   ### Background
   
   **How is a SQL parsed?**
   `SQL definition file` 
   ->(Parse to) 
   `AST`
   ->(Visit it)  
   `SQLStatment`  
   
   
   
   
   ### Process
   
   1. Compare `SQL definitions` in [Oficial SQL Doc](https://docs.microsoft.com/zh-cn/sql/t-sql/queries/select-transact-sql?view=sql-server-ver15) and [ShardingSphere SQL Doc](https://github.com/apache/shardingsphere/tree/master/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-sqlserver/src/main/antlr4/imports/sqlserver)
   2. If there is any difference in ShardingSphere SQL Doc, please correct them referring to Official SQL Doc
   3. Run `mvn install the current_file_module` 
   4. Check whether there are any exceptions. If indeed, please fix them. (Especially `xxxVisitor.class`)
   5. Add new corresponding SQL case in [SQL Cases](https://github.com/apache/shardingsphere/tree/master/shardingsphere-sql-parser/shardingsphere-sql-parser-test/src/test/resources/sql/supported) and expected parsed result in [Expected Statment XML](https://github.com/apache/shardingsphere/tree/master/shardingsphere-sql-parser/shardingsphere-sql-parser-test/src/test/resources/case)
   6. Run [SQLParserParameterizedTest](https://github.com/apache/shardingsphere/blob/master/shardingsphere-sql-parser/shardingsphere-sql-parser-test/src/test/java/org/apache/shardingsphere/sql/parser/integrate/engine/SQLParserParameterizedTest.java) to make sure no exceptions.
   
   ### Notice
   1.`Left recursion` can not work well in Antlr4, 
   ```
   a
     : b
     | a b
     ;
   b
     : a c
     ;
   c
     : ...
     ;
   ```
   you can consider the following one,
   ```
   a
     : b*
     ;
   b
     : a c
     ;
   c
     : ...
     ;
   ```
   
   2. [Here](https://shimo.im/docs/WrgrCt9JR3JDjq8H/read) is a Chinese version for reference.
   
   ### subtask
   1、DML
     - [ ] select   [offical doc](https://docs.microsoft.com/en-us/sql/t-sql/queries/select-transact-sql?view=sql-server-ver15)
     - [ ] insert   [offical doc](https://docs.microsoft.com/en-us/sql/t-sql/statements/insert-transact-sql?view=sql-server-ver15)
     - [ ] update   [offical doc](https://docs.microsoft.com/en-us/sql/t-sql/queries/update-transact-sql?view=sql-server-ver15)
     - [ ] delete   [offical doc](https://docs.microsoft.com/en-us/sql/t-sql/statements/delete-transact-sql?view=sql-server-ver15)
     - [ ] merge    [offical doc](https://docs.microsoft.com/en-us/sql/t-sql/statements/merge-transact-sql?view=sql-server-ver15)
   
   2、DDL-ALTER
   
     - [x] alter table       [offical doc](https://docs.microsoft.com/en-us/sql/t-sql/statements/alter-table-transact-sql?view=sql-server-ver15)
     - [x] alter database    [offical doc](https://docs.microsoft.com/en-us/sql/t-sql/statements/alter-database-transact-sql?view=sql-server-ver15&tabs=sqlpool)
     - [x] alter procedure   [offical doc](https://docs.microsoft.com/en-us/sql/t-sql/statements/alter-procedure-transact-sql?view=sql-server-ver15)
     - [x] alter function    [offical doc](https://docs.microsoft.com/en-us/sql/t-sql/statements/alter-function-transact-sql?view=sql-server-ver15)
     - [x] alter view        [offical doc](https://docs.microsoft.com/en-us/sql/t-sql/statements/alter-view-transact-sql?view=sql-server-ver15)
     - [x] alter index       [offical doc](https://docs.microsoft.com/en-us/sql/t-sql/statements/alter-index-transact-sql?view=sql-server-ver15)
     - [ ] alter schema      [offical doc](https://docs.microsoft.com/en-us/sql/t-sql/statements/alter-schema-transact-sql?view=sql-server-ver15)
     - [x] alter trigger     [offical doc](https://docs.microsoft.com/en-us/sql/t-sql/statements/alter-trigger-transact-sql?view=sql-server-ver15)
     - [x] alter sequence    [offical doc](https://docs.microsoft.com/en-us/sql/t-sql/statements/alter-sequence-transact-sql?view=sql-server-ver15)
     - [ ] alter service     [offical doc](https://docs.microsoft.com/en-us/sql/t-sql/statements/alter-service-transact-sql?view=sql-server-ver15)
   
   3、DDL-CREATE
   
     - [x] create table      [offical doc](https://docs.microsoft.com/en-us/sql/t-sql/statements/create-table-transact-sql?view=sql-server-ver15)
     - [x] create index      [offical doc](https://docs.microsoft.com/en-us/sql/t-sql/statements/create-index-transact-sql?view=sql-server-ver15)
     - [x] create database   [offical doc](https://docs.microsoft.com/en-us/sql/t-sql/statements/create-database-transact-sql?view=sql-server-ver15&tabs=sqlpool)
     - [x] create function   [offical doc](https://docs.microsoft.com/en-us/sql/t-sql/statements/create-function-transact-sql?view=sql-server-ver15)
     - [x] create procedure  [offical doc](https://docs.microsoft.com/en-us/sql/t-sql/statements/create-procedure-transact-sql?view=sql-server-ver15)
     - [ ] create service    [offical doc](https://docs.microsoft.com/en-us/sql/t-sql/statements/create-service-transact-sql?view=sql-server-ver15)
     - [x] create view       [offical doc](https://docs.microsoft.com/en-us/sql/t-sql/statements/create-view-transact-sql?view=sql-server-ver15)
     - [x] create trigger    [offical doc](https://docs.microsoft.com/en-us/sql/t-sql/statements/create-trigger-transact-sql?view=sql-server-ver15)
     - [ ] create schema     [offical doc](https://docs.microsoft.com/en-us/sql/t-sql/statements/create-schema-transact-sql?view=sql-server-ver15)
     - [x] create sequence   [offical doc](https://docs.microsoft.com/en-us/sql/t-sql/statements/create-sequence-transact-sql?view=sql-server-ver15)
   
    4、DDL-DROP
   
     - [x] drop table      [offical doc](https://docs.microsoft.com/en-us/sql/t-sql/statements/drop-table-transact-sql?view=sql-server-ver15)
     - [x] drop index      [offical doc](https://docs.microsoft.com/en-us/sql/t-sql/statements/drop-index-transact-sql?view=sql-server-ver15)
     - [x] drop database   [offical doc](https://docs.microsoft.com/en-us/sql/t-sql/statements/drop-database-transact-sql?view=sql-server-ver15&tabs=sqlpool)
     - [x] drop function   [offical doc](https://docs.microsoft.com/en-us/sql/t-sql/statements/drop-function-transact-sql?view=sql-server-ver15)
     - [x] drop procedure  [offical doc](https://docs.microsoft.com/en-us/sql/t-sql/statements/drop-procedure-transact-sql?view=sql-server-ver15)
     - [ ] drop service    [offical doc](https://docs.microsoft.com/en-us/sql/t-sql/statements/drop-service-transact-sql?view=sql-server-ver15)
     - [x] drop view       [offical doc](https://docs.microsoft.com/en-us/sql/t-sql/statements/drop-view-transact-sql?view=sql-server-ver15)
     - [x] drop trigger    [offical doc](https://docs.microsoft.com/en-us/sql/t-sql/statements/drop-trigger-transact-sql?view=sql-server-ver15)
     - [ ] drop schema     [offical doc](https://docs.microsoft.com/en-us/sql/t-sql/statements/drop-schema-transact-sql?view=sql-server-ver15)
     - [x] drop sequence   [offical doc](https://docs.microsoft.com/en-us/sql/t-sql/statements/drop-sequence-transact-sql?view=sql-server-ver15)
   
   
   5、DCL
   
     - [x] grant          [offical doc](https://docs.microsoft.com/en-us/sql/t-sql/statements/grant-transact-sql?view=sql-server-ver15)
     - [x] revoke         [offical doc](https://docs.microsoft.com/en-us/sql/t-sql/statements/revoke-transact-sql?view=sql-server-ver15)
     - [x] deny           [offical doc](https://docs.microsoft.com/en-us/sql/t-sql/statements/deny-transact-sql?view=sql-server-ver15)
     - [x] revert         [offical doc](https://docs.microsoft.com/en-us/sql/t-sql/statements/revert-transact-sql?view=sql-server-ver15)
     - [x] setuser        [offical doc](https://docs.microsoft.com/en-us/sql/t-sql/statements/setuser-transact-sql?view=sql-server-ver15)
     - [x] alter user     [offical doc](   https://docs.microsoft.com/en-us/sql/t-sql/statements/alter-user-transact-sql?view=sql-server-ver15)
     - [x] alter role     [offical doc](   https://docs.microsoft.com/en-us/sql/t-sql/statements/alter-role-transact-sql?view=sql-server-ver15)
     - [x] alter login    [offical doc](   https://docs.microsoft.com/en-us/sql/t-sql/statements/alter-login-transact-sql?view=sql-server-ver15)
     - [x] create user    [offical doc](   https://docs.microsoft.com/en-us/sql/t-sql/statements/create-user-transact-sql?view=sql-server-ver15)
     - [x] create role    [offical doc](   https://docs.microsoft.com/en-us/sql/t-sql/statements/create-role-transact-sql?view=sql-server-ver15)
     - [x] create login   [offical doc](   https://docs.microsoft.com/en-us/sql/t-sql/statements/create-login-transact-sql?view=sql-server-ver15)
     - [x] drop user      [offical doc]( https://docs.microsoft.com/en-us/sql/t-sql/statements/drop-user-transact-sql?view=sql-server-ver15)
     - [x] drop role      [offical doc]( https://docs.microsoft.com/en-us/sql/t-sql/statements/drop-role-transact-sql?view=sql-server-ver15)
     - [x] drop login     [offical doc]( https://docs.microsoft.com/en-us/sql/t-sql/statements/drop-login-transact-sql?view=sql-server-ver15)
   
   
   6、TCL
   
     - [x] tranction            [offical doc](https://docs.microsoft.com/en-us/sql/t-sql/language-elements/transactions-transact-sql?view=sql-server-ver15)
     - [x] rollback tranction   [offical doc](https://docs.microsoft.com/en-us/sql/t-sql/language-elements/rollback-transaction-transact-sql?view=sql-server-ver15)
     - [x] commit tranction     [offical doc](https://docs.microsoft.com/en-us/sql/t-sql/language-elements/commit-transaction-transact-sql?view=sql-server-ver15)
     - [x] save tranction       [offical doc](https://docs.microsoft.com/en-us/sql/t-sql/language-elements/save-transaction-transact-sql?view=sql-server-ver15)
     - [x] commit work          [offical doc](https://docs.microsoft.com/en-us/sql/t-sql/language-elements/commit-work-transact-sql?view=sql-server-ver15)
     - [x] rollback work        [offical doc](https://docs.microsoft.com/en-us/sql/t-sql/language-elements/rollback-work-transact-sql?view=sql-server-ver15)
   
   
   7、DAL
   
     - [x] explain         [offical doc](https://docs.microsoft.com/en-us/sql/t-sql/queries/explain-transact-sql?view=azure-sqldw-latest)


-- 
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.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [shardingsphere] github-actions[bot] commented on issue #6478: [SQL Definition Collation][SQLServer]Collate the g4 files of SQL definitions

Posted by GitBox <gi...@apache.org>.
github-actions[bot] commented on issue #6478:
URL: https://github.com/apache/shardingsphere/issues/6478#issuecomment-1272351054

   Hello , this issue has not received a reply for several days.
   This issue is supposed to be closed.


-- 
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] ThanoshanMV commented on issue #6478: [SQL Definition Collation][SQLServer]Collate the g4 files of SQL definitions

Posted by GitBox <gi...@apache.org>.
ThanoshanMV commented on issue #6478:
URL: https://github.com/apache/shardingsphere/issues/6478#issuecomment-1115835887

   > Hi @ThanoshanMV, I don't think the startIndex of SubquerySegment should contain parentheses, it's just a simple wrapper around the select statement to identify the subquery.
   
   Thank you @strongduanmu.


-- 
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 #6478: [SQL Definition Collation][SQLServer]Collate the g4 files of SQL definitions

Posted by GitBox <gi...@apache.org>.
strongduanmu commented on issue #6478:
URL: https://github.com/apache/shardingsphere/issues/6478#issuecomment-1272454451

   This issue has not been finished, so I will reopen 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


Re: [I] [SQL Definition Collation][SQLServer]Collate the g4 files of SQL definitions [shardingsphere]

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on issue #6478:
URL: https://github.com/apache/shardingsphere/issues/6478#issuecomment-2028457542

   There hasn't been any activity on this issue recently, and in order to prioritize active issues, it will be marked as stale.


-- 
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] ThanoshanMV commented on issue #6478: [SQL Definition Collation][SQLServer]Collate the g4 files of SQL definitions

Posted by GitBox <gi...@apache.org>.
ThanoshanMV commented on issue #6478:
URL: https://github.com/apache/shardingsphere/issues/6478#issuecomment-1114925721

   Hi @strongduanmu. In `WITH dept_costs AS (SELECT department_name, SUM(salary) dept_total FROM departments d GROUP BY department_name) SELECT * FROM dept_costs WHERE dept_total > 304500 ORDER BY department_name` SQL statement, `SubquerySegment`'s startIndex should begin with parenthesis or from the character 'S'?


-- 
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 #6478: [SQL Definition Collation][SQLServer]Collate the g4 files of SQL definitions

Posted by GitBox <gi...@apache.org>.
strongduanmu commented on issue #6478:
URL: https://github.com/apache/shardingsphere/issues/6478#issuecomment-1115831338

   Hi @ThanoshanMV, I don't think the startIndex of SubquerySegment should contain parentheses, it's just a simple wrapper around the select statement to identify the subquery. 


-- 
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] github-actions[bot] closed issue #6478: [SQL Definition Collation][SQLServer]Collate the g4 files of SQL definitions

Posted by GitBox <gi...@apache.org>.
github-actions[bot] closed issue #6478: [SQL Definition Collation][SQLServer]Collate the g4 files of SQL definitions
URL: https://github.com/apache/shardingsphere/issues/6478


-- 
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] ThanoshanMV commented on issue #6478: [SQL Definition Collation][SQLServer]Collate the g4 files of SQL definitions

Posted by GitBox <gi...@apache.org>.
ThanoshanMV commented on issue #6478:
URL: https://github.com/apache/shardingsphere/issues/6478#issuecomment-1131624411

   Sure @zrsaber.


-- 
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] zrsaber commented on issue #6478: [SQL Definition Collation][SQLServer]Collate the g4 files of SQL definitions

Posted by GitBox <gi...@apache.org>.
zrsaber commented on issue #6478:
URL: https://github.com/apache/shardingsphere/issues/6478#issuecomment-1131620644

   Hi @ThanoshanMV , I want to work on this first:
   
    drop schema


-- 
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