-
Notifications
You must be signed in to change notification settings - Fork 3.1k
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
Literal parsing bug #24784
Comments
The 1st and 3rd error messages are thrown here in SqlParser.java in the rule I believe there are two ways to catch this error and give it a meaningful message:
I'll go with option #1 because it leaves the grammar tidier, but I can do #2 if you prefer. Either way, a query like I still didn't investigate the cause for the 2nd bug that @mosabua found, but I believe it won't happen after we introduce the INVALID_NUMBER rule. |
BTW, is it intentional that doubles cannot contain underscores? trino/core/trino-grammar/src/main/antlr4/io/trino/grammar/sql/SqlBase.g4 Lines 1365 to 1368 in 76d1e6f
|
@mosabua this is actually correct:
It is confusing because these two are not separated by a space. @brunokim the change you proposed doesn't affect this case. |
@brunokim initially Trino did not support underscores at all. At some point we added support for underscore for exact numeric types, but we never did it for double. According to the spec @martint was there anything that stopped us from supporting underscore in doubles? |
Could we change this to force the requirement for a space .. the way it works now is super counterintuitive .. or maybe even just not allow it and throw an error. |
@mosabua I don't think we can enforce a whitespace in a particular context. We would end up multiplying lexer rules. I agree this is not intuitive but this is a result of having numbers ending in a '.' and identifiers starting with a '_' |
When testing for #24774 I found what I think is a bug.
Normally a underscore at the comma fails as expected .. but maybe with a wrong error message.
However if the underscore is after the comma .. it uses it as a name for the column
Similar error with double underscore:
I believe these should all fail .. but with a better error message.
The text was updated successfully, but these errors were encountered: