Skip to content
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

Fix 'APPLY lambda' parsing #32138

Merged
merged 6 commits into from
Dec 9, 2021
Merged

Conversation

Avogar
Copy link
Member

@Avogar Avogar commented Dec 2, 2021

Changelog category (leave one):

  • Bug Fix (user-visible misbehaviour in official stable or prestable release)

Changelog entry (a user-readable short description of the changes that goes to CHANGELOG.md):
Fix 'APPLY lambda' parsing which could lead to client/server crash.

Detailed description / Documentation draft:
...

@robot-clickhouse robot-clickhouse added the pr-bugfix Pull request with bugfix, not backported by default label Dec 2, 2021
@alexey-milovidov alexey-milovidov self-assigned this Dec 2, 2021
@nikitamikhaylov
Copy link
Member

Do we need to backport this bugfix?

@Avogar
Copy link
Member Author

Avogar commented Dec 2, 2021

Do we need to backport this bugfix?

It reproduces only on 21.10 and 21.11, on 21.9 and lower versions there is no such bug, so I think we should backport it.

@alexey-milovidov alexey-milovidov added the pr-must-backport Pull request should be backported intentionally. Use this label with great care! label Dec 2, 2021
@Avogar
Copy link
Member Author

Avogar commented Dec 3, 2021

@Mergifyio update

@mergify
Copy link
Contributor

mergify bot commented Dec 3, 2021

update

✅ Branch has been successfully updated

@alexey-milovidov
Copy link
Member

We don't expect exceptions in parser, better to return false (syntax error).

@Avogar
Copy link
Member Author

Avogar commented Dec 3, 2021

We don't expect exceptions in parser, better to return false (syntax error).

I'm not sure that we should treat such cases as syntax error. You can look at the queries in the test, everything is ok in terms of syntax, instead we can see just the wrong use of function/wrong arguments/wrong type

@alexey-milovidov
Copy link
Member

Ok. But AST fuzzer is assuming that parser does not throw exceptions.
Maybe change AST fuzzer?

@Avogar
Copy link
Member Author

Avogar commented Dec 6, 2021

Ok. But AST fuzzer is assuming that parser does not throw exceptions.

I checked our code in Parsers folder, there are several places where we can find throwing exceptions (not SYNTAX_ERROR)(ParserCreateQuery.cpp/ParserSelectQuery.cpp/ExpressionElementParsers.cpp). So I guess we just don't have tests for such cases (otherwise AST fuzzer could faild).

Maybe change AST fuzzer?

What do you suggest? Skipping all exceptions sounds bad. Now we skip exceptions with two error codes: SYNTAX_ERROR/TOO_DEEP_RECURSION. I see two variants. We can change all error codes in parsers to SYNTAX_ERROR or we can create the list of error codes that parsers could throw and skip it.

@alexey-milovidov
Copy link
Member

Simply change the code to SYNTAX_ERROR and merge this PR 🚀

@Avogar
Copy link
Member Author

Avogar commented Dec 8, 2021

@Mergifyio update

@mergify
Copy link
Contributor

mergify bot commented Dec 8, 2021

update

✅ Branch has been successfully updated

alexey-milovidov added a commit that referenced this pull request Dec 9, 2021
Backport #32138 to 21.11: Fix 'APPLY lambda' parsing
alexey-milovidov added a commit that referenced this pull request Dec 15, 2021
Backport #32138 to 21.12: Fix 'APPLY lambda' parsing
Avogar added a commit that referenced this pull request Dec 20, 2021
Backport #32138 to 21.10: Fix 'APPLY lambda' parsing
@Felixoid Felixoid added the pr-backports-created Backport PRs are successfully created, it won't be processed by CI script anymore label Jul 14, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pr-backports-created Backport PRs are successfully created, it won't be processed by CI script anymore pr-bugfix Pull request with bugfix, not backported by default pr-must-backport Pull request should be backported intentionally. Use this label with great care!
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants