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

[I] Consider removing sqlCommentParseEnabled config in SQLParser rule [shardingsphere]

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

   ## Feature Request
   
   ### Is your feature request related to a problem?
   
   No.
   
   ### Describe the feature you would like.
   
   In #20736, ShardingSphere provides support for SQL hints. Currently, there are two ways to extract SQLHint syntax, one is using SQL Parser and the other is using SQLHintUtils. If both methods are supported at the same time, the processing logic of SQL Hint is too complicated, and HintValueContext may already be used before props are extracted. This affects the SQL Hint use experience.
   
   <img width="1148" alt="image" src="https://github.com/apache/shardingsphere/assets/10829171/71226d1a-1c86-4118-8a86-e009ae953102">
   
   Considering that SQLHintUtils has been used as the default method for a long time, SQLHint has better functionality and performance than SQL Parser, so consider removing the sqlCommentParseEnabled parameter. And remove the way SQL Parser extracts SQL Hint syntax.
   
   The current configuration of SQL Parser Rule:
   
   ```yaml
   #sqlParser:
   #  sqlCommentParseEnabled: false
   #  sqlStatementCache:
   #    initialCapacity: 2000
   #    maximumSize: 65535
   #  parseTreeCache:
   #    initialCapacity: 128
   #    maximumSize: 1024
   ```
   
   And the new SQL Parser Rule configuration:
   
   ```yaml
   #sqlParser:
   #  sqlStatementCache:
   #    initialCapacity: 2000
   #    maximumSize: 65535
   #  parseTreeCache:
   #    initialCapacity: 128
   #    maximumSize: 1024
   ```
   
   ### Tasks
   
   - [ ] remove sqlCommentParseEnabled in SQL Parser Rule and kernel
   - [ ] remove sqlCommentParseEnabled in DistSQL
   - [ ] remove sqlCommentParseEnabled in doc, and update SQL Hint usage description - https://shardingsphere.apache.org/document/current/en/user-manual/common-config/sql-hint/
   
   


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


Re: [I] Consider removing sqlCommentParseEnabled config in SQLParser rule [shardingsphere]

Posted by "strongduanmu (via GitHub)" <gi...@apache.org>.
strongduanmu commented on issue #29535:
URL: https://github.com/apache/shardingsphere/issues/29535#issuecomment-1870055755

   Perhaps we could also preserve the parsing of native SQL annotations, which might be required for sql federation queries.
   


-- 
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] Consider removing sqlCommentParseEnabled config in SQLParser rule [shardingsphere]

Posted by "TherChenYang (via GitHub)" <gi...@apache.org>.
TherChenYang commented on issue #29535:
URL: https://github.com/apache/shardingsphere/issues/29535#issuecomment-1870008015

   Hello, it seems that I couldn't find how to use SQLParser to parse SHARDINGSPHERE_HINT in comments, Many places are parsed using SQLHintUtils. Could you please guide 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


Re: [I] Consider removing sqlCommentParseEnabled config in SQLParser rule [shardingsphere]

Posted by "strongduanmu (via GitHub)" <gi...@apache.org>.
strongduanmu commented on issue #29535:
URL: https://github.com/apache/shardingsphere/issues/29535#issuecomment-1868720298

   @TherChenYang Welcome, I will assign it 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


Re: [I] Consider removing sqlCommentParseEnabled config in SQLParser rule [shardingsphere]

Posted by "TherChenYang (via GitHub)" <gi...@apache.org>.
TherChenYang commented on issue #29535:
URL: https://github.com/apache/shardingsphere/issues/29535#issuecomment-1871173557

   I have updated the document, please check 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] Consider removing sqlCommentParseEnabled config in SQLParser rule [shardingsphere]

Posted by "strongduanmu (via GitHub)" <gi...@apache.org>.
strongduanmu closed issue #29535: Consider removing sqlCommentParseEnabled config in SQLParser rule
URL: https://github.com/apache/shardingsphere/issues/29535


-- 
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] Consider removing sqlCommentParseEnabled config in SQLParser rule [shardingsphere]

Posted by "TherChenYang (via GitHub)" <gi...@apache.org>.
TherChenYang commented on issue #29535:
URL: https://github.com/apache/shardingsphere/issues/29535#issuecomment-1870033889

   I found these.
   ![image](https://github.com/apache/shardingsphere/assets/124348939/f485df69-2560-41c0-9783-b9ec70c737f5)
   My understanding of this issue is as follows:
   1. Remove the sqlCommentParseEnabled switch, and by default parse annotations into CommentSegment during the SQL parsing process.
   2. Execute the SQLHintUtils.extractHint(sql) method as the default method.
   Is it correct?


-- 
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] Consider removing sqlCommentParseEnabled config in SQLParser rule [shardingsphere]

Posted by "TherChenYang (via GitHub)" <gi...@apache.org>.
TherChenYang commented on issue #29535:
URL: https://github.com/apache/shardingsphere/issues/29535#issuecomment-1868718160

   @strongduanmu I can try to complete it. I have not done similar tasks before, but I will do my best.


-- 
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] Consider removing sqlCommentParseEnabled config in SQLParser rule [shardingsphere]

Posted by "strongduanmu (via GitHub)" <gi...@apache.org>.
strongduanmu commented on issue #29535:
URL: https://github.com/apache/shardingsphere/issues/29535#issuecomment-1870961824

   Since the document has not been updated, I will reopen the issue.
   


-- 
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] Consider removing sqlCommentParseEnabled config in SQLParser rule [shardingsphere]

Posted by "strongduanmu (via GitHub)" <gi...@apache.org>.
strongduanmu commented on issue #29535:
URL: https://github.com/apache/shardingsphere/issues/29535#issuecomment-1870043955

   @TherChenYang There are two types of annotations, ShardingSphere annotations, which are extracted using SQLHintUtils and then removed from the SQL. The second is native SQL comments, which need to be skipped instead of parsed into CommentSegment, because the ShardingSphere does not process native SQL comments.
   


-- 
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] Consider removing sqlCommentParseEnabled config in SQLParser rule [shardingsphere]

Posted by "strongduanmu (via GitHub)" <gi...@apache.org>.
strongduanmu closed issue #29535: Consider removing sqlCommentParseEnabled config in SQLParser rule
URL: https://github.com/apache/shardingsphere/issues/29535


-- 
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] Consider removing sqlCommentParseEnabled config in SQLParser rule [shardingsphere]

Posted by "strongduanmu (via GitHub)" <gi...@apache.org>.
strongduanmu commented on issue #29535:
URL: https://github.com/apache/shardingsphere/issues/29535#issuecomment-1870012097

   > Hello, it seems that I couldn't find how to use SQLParser to parse SHARDINGSPHERE_HINT in comments, Many places are parsed using SQLHintUtils. Could you please guide me?
   
   You can try to remove sqlCommentParseEnabled first. And you will find the logic in SQL Parser module.


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