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


   ### Which version of ShardingSphere did you use?
   
   master branch
   
   ### Which project did you use? ShardingSphere-JDBC or ShardingSphere-Proxy?
   
   ShardingSphere-JDBC
   
   ### Expected behavior
   
   execute select statement success
   
   ### Actual behavior
   
   throw exception——`line 1:56 no viable alternative at input '=current_date('`
   
   ### Reason analyze (If you can)
   
   ```g4
   regularFunction
       : completeRegularFunction
       | shorthandRegularFunction
       ;
       
   shorthandRegularFunction
       : CURRENT_DATE | CURRENT_TIME (LP_ NUMBER_? RP_)? | CURRENT_TIMESTAMP | 
LAST_DAY | LOCALTIME | LOCALTIMESTAMP
       ;
       
   completeRegularFunction
       : regularFunctionName (LP_ (expr (COMMA_ expr)* | ASTERISK_)? RP_)
       ;
       
   regularFunctionName
       : IF | LOCALTIME | LOCALTIMESTAMP | REPLACE | INTERVAL | MOD
       | DATABASE | SCHEMA | LEFT | RIGHT | DATE | DAY | GEOMETRYCOLLECTION
       | LINESTRING | MULTILINESTRING | MULTIPOINT | MULTIPOLYGON | POINT | 
POLYGON
       | TIME | TIMESTAMP | TIMESTAMP_ADD | TIMESTAMP_DIFF | DATE | 
CURRENT_TIMESTAMP | identifier
       ;
   ```
   
   From the following g4 file, we can see that the `current_date()` function is 
ambiguous. Due to the priority during parsing, the shorthandRegularFunction 
rule will be used for parsing, but the shorthandRegularFunction rule cannot 
parse the parentheses.
   
   We should define a parenthesized function with the same name in the 
completeRegularFunction rule to avoid parsing problems caused by priority.
   
   ### Steps to reproduce the behavior, such as: SQL to execute, sharding rule 
configuration, when exception occur etc.
   
   ### Example codes for reproduce this issue (such as a github link).
   


-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to