You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by "zihaoAK47 (via GitHub)" <gi...@apache.org> on 2023/05/12 11:27:36 UTC

[GitHub] [shardingsphere] zihaoAK47 opened a new pull request, #25620: Support MySQL Oracle DROP USER statement for SQL parsing based on IP address deletion.

zihaoAK47 opened a new pull request, #25620:
URL: https://github.com/apache/shardingsphere/pull/25620

   Fixes #25535 .
   
   Changes proposed in this pull request:
     - MySQL Oracle DROP USER statement for SQL parsing based on IP address deletion
   
   ---
   
   Before committing this PR, I'm sure that I have checked the following options:
   - [✓] My code follows the [code of conduct](https://shardingsphere.apache.org/community/en/involved/conduct/code/) of this project.
   - [✓] I have self-reviewed the commit code.
   - [ ] I have (or in comment I request) added corresponding labels for the pull request.
   - [ ] I have passed maven check locally : `./mvnw clean install -B -T1C -Dmaven.javadoc.skip -Dmaven.jacoco.skip -e`.
   - [ ] I have made corresponding changes to the documentation.
   - [✓] I have added corresponding unit tests for my changes.
   


-- 
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 a diff in pull request #25620: Support MySQL Oracle DROP USER statement for SQL parsing based on IP address deletion.

Posted by "strongduanmu (via GitHub)" <gi...@apache.org>.
strongduanmu commented on code in PR #25620:
URL: https://github.com/apache/shardingsphere/pull/25620#discussion_r1193282339


##########
parser/sql/dialect/mysql/src/main/antlr4/imports/mysql/Literals.g4:
##########
@@ -66,10 +66,15 @@ BIT_NUM_
     ;
 
 IDENTIFIER_
-    : [A-Za-z_$0-9\u0080-\uFFFF]*?[A-Za-z_$\u0080-\uFFFF]+?[A-Za-z_$0-9\u0080-\uFFFF]*
+    :  IP_ADDRESS

Review Comment:
   Following is ShardingSphere BaseRule.g4 content:
   
   ```
   textOrIdentifier
       : identifier | string_
       ;
       
   variable
       : userVariable | systemVariable
       ;
       
   userVariable
       : AT_ textOrIdentifier
       | textOrIdentifier
       ;
   ```



##########
parser/sql/dialect/mysql/src/main/antlr4/imports/mysql/Literals.g4:
##########
@@ -66,10 +66,15 @@ BIT_NUM_
     ;
 
 IDENTIFIER_
-    : [A-Za-z_$0-9\u0080-\uFFFF]*?[A-Za-z_$\u0080-\uFFFF]+?[A-Za-z_$0-9\u0080-\uFFFF]*
+    :  IP_ADDRESS

Review Comment:
   Can you move ip address parse to BaseRule? You can refer mysql parse logic in sql_yacc.yy file.
   
   ```
   ident_or_text:
             ident           { $$=$1;}
           | TEXT_STRING_sys { $$=$1;}
           | LEX_HOSTNAME { $$=$1;}
           ;
   
   role_ident_or_text:
             role_ident
           | TEXT_STRING_sys
           | LEX_HOSTNAME
           ;
   
   user_ident_or_text:
             ident_or_text
             {
               if (!($$= LEX_USER::alloc(YYTHD, &$1, NULL)))
                 MYSQL_YYABORT;
             }
           | ident_or_text '@' ident_or_text
             {
               if (!($$= LEX_USER::alloc(YYTHD, &$1, &$3)))
                 MYSQL_YYABORT;
             }
           ;
   ```



-- 
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 pull request #25620: Support MySQL Oracle DROP USER statement for SQL parsing based on IP address deletion.

Posted by "strongduanmu (via GitHub)" <gi...@apache.org>.
strongduanmu commented on PR #25620:
URL: https://github.com/apache/shardingsphere/pull/25620#issuecomment-1548829458

   Hi @zihaoAK47, can you comment on the original issue? I will assign it to you, and you can claim the subtasks you want to do.
   


-- 
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] zihaoAK47 commented on a diff in pull request #25620: Support MySQL Oracle DROP USER statement for SQL parsing based on IP address deletion.

Posted by "zihaoAK47 (via GitHub)" <gi...@apache.org>.
zihaoAK47 commented on code in PR #25620:
URL: https://github.com/apache/shardingsphere/pull/25620#discussion_r1193726570


##########
parser/sql/dialect/mysql/src/main/antlr4/imports/mysql/Literals.g4:
##########
@@ -66,10 +66,15 @@ BIT_NUM_
     ;
 
 IDENTIFIER_
-    : [A-Za-z_$0-9\u0080-\uFFFF]*?[A-Za-z_$\u0080-\uFFFF]+?[A-Za-z_$0-9\u0080-\uFFFF]*
+    :  IP_ADDRESS

Review Comment:
   Hi, I tried defining the syntax parsing rules for IP addresses in BaseRule.g4. 
   However, during testing, I found that IP addresses were being matched by the NUMBER_ lexical rule in Literals.g4 file first. 
   I have tried defining the rules multiple times, but the NUMBER_ rule always takes priority.
   
   I have defined the IP_ADDRESS lexical rule in the Literals.g4 file and referenced it in the ipAddress rule in the BaseRule.g4 file. Would this be a correct approach? 



-- 
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 merged pull request #25620: Support MySQL Oracle DROP USER statement for SQL parsing based on IP address deletion.

Posted by "strongduanmu (via GitHub)" <gi...@apache.org>.
strongduanmu merged PR #25620:
URL: https://github.com/apache/shardingsphere/pull/25620


-- 
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 a diff in pull request #25620: Support MySQL Oracle DROP USER statement for SQL parsing based on IP address deletion.

Posted by "strongduanmu (via GitHub)" <gi...@apache.org>.
strongduanmu commented on code in PR #25620:
URL: https://github.com/apache/shardingsphere/pull/25620#discussion_r1194498008


##########
parser/sql/dialect/mysql/src/main/antlr4/imports/mysql/Literals.g4:
##########
@@ -66,10 +66,15 @@ BIT_NUM_
     ;
 
 IDENTIFIER_
-    : [A-Za-z_$0-9\u0080-\uFFFF]*?[A-Za-z_$\u0080-\uFFFF]+?[A-Za-z_$0-9\u0080-\uFFFF]*
+    :  IP_ADDRESS

Review Comment:
   > I have defined the IP_ADDRESS lexical rule in the Literals.g4 file and referenced it in the ipAddress rule in the BaseRule.g4 file. Would this be a correct approach?
   
   Yes, that's what I mean. Instead of changing the definition of the identifier, add an ipAddress rule to the textOrIdentifier.
   



-- 
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] zihaoAK47 commented on pull request #25620: Support MySQL Oracle DROP USER statement for SQL parsing based on IP address deletion.

Posted by "zihaoAK47 (via GitHub)" <gi...@apache.org>.
zihaoAK47 commented on PR #25620:
URL: https://github.com/apache/shardingsphere/pull/25620#issuecomment-1547067485

   @strongduanmu please review 


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