Skip to content

[Bug]: sql未正确输入结束但被解析为语法正确的statement #363

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
JackWang032 opened this issue Nov 7, 2024 · 1 comment
Assignees

Comments

@JackWang032
Copy link
Collaborator

JackWang032 commented Nov 7, 2024

Version

v4.1

Which SQL?

Hive

SQL content

CREATE TABLE table1

JavaScript/TypeScript code

No response

What happened?

建表语句缺少列定义的情况,在 Hive 实际语法中是非法的,但在解析树中没有报错
image

导致 c3 收集补全时把 statement 开头的所有关键字都收集进来了,正常应该是 AS、Like等等
image

Relevant log output

No response

@JackWang032
Copy link
Collaborator Author

这是由于所有类型 SQL 中语句结束符分号都是可选的导致的,考虑可以通过 action 的方式往g4中注入运行时代码,当进行getSuggestion时使分号必选以进行正确的 SQL 切分。

Image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant