apache / shardingsphere

Distributed SQL transaction & query engine for data sharding, scaling, encryption, and more - on any database.
Apache License 2.0
19.88k stars 6.73k forks source link

Can not find visitor rule: `TerminalNodeImpl` when parsing /*! MySQL-specific code */ #18701

Open TeslaCN opened 2 years ago

TeslaCN commented 2 years ago

Bug Report

Which version of ShardingSphere did you use?

master - 280415ac7c89e5bc4f9829ef1b96a31e917910c6

Expected behavior

SQL in the block could be parsed into AST.

/*! set global max_connections=123 */;
/*!80029 set global max_connections=456 */;

Refer to https://dev.mysql.com/doc/refman/5.7/en/comments.html

Actual behavior

Unsupported.

ERROR 1997 (C1997): Runtime exception: [Can not find visitor rule: `TerminalNodeImpl`]

image

strongduanmu commented 2 years ago

@TeslaCN Thank you for your feedback, I will investigate this issue.

strongduanmu commented 2 years ago

Currently, SQL comments are added to the hidden channel during the lexical parsing phase, not the AST. That is, the SQL we parsed is an empty string.

Considering that there are many extended syntaxes supported in MySQL comment, we will consider supporting parsing of these SQLs.

github-actions[bot] commented 2 years ago

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