Shadow DistSQL cannot parse unquoted SQL_HINT algorithm type
Bug Report
Which version of ShardingSphere did you use?
master @ 101c3d56ccd (5.5.4-SNAPSHOT)
Which project did you use? ShardingSphere-JDBC or ShardingSphere-Proxy?
Proxy
Expected behavior
SQL_HINT is one of the three built-in shadow algorithm types, so it should be usable without quotes, like VALUE_MATCH and REGEX_MATCH:
ALTER DEFAULT SHADOW ALGORITHM TYPE(NAME=SQL_HINT);Actual behavior
The statement above is rejected with You have an error in your SQL syntax. Instead, the removed legacy spelling TYPE(NAME=SIMPLE_HINT) is accepted, then fails because no ShadowAlgorithm is registered for it.
Reason analyze (If you can)
In features/shadow/distsql/parser/src/main/antlr4/imports/shadow/Keyword.g4 the SQL_HINT token is declared as S I M P L E UL_ H I N T, so it matches the text SIMPLE_HINT rather than SQL_HINT.
#23972 renamed this algorithm from SIMPLE_HINT to SQL_HINT and updated the token name, but not the characters the token matches. SQLHintShadowAlgorithm.getType() returns SQL_HINT, and the sibling tokens VALUE_MATCH and REGEX_MATCH match their own names.
Steps to reproduce the behavior, such as: SQL to execute, sharding rule configuration, when exception occur etc.
Execute ALTER DEFAULT SHADOW ALGORITHM TYPE(NAME=SQL_HINT) against ShardingSphere-Proxy.
Example codes for reproduce this issue (such as a github link).
N/A
Source: apache/shardingsphere