Uh oh!
There was an error while loading. Please reload this page.
Add #[recursive] - #1522
Conversation
458f748 to
a4a5794CompareI was wondering if we should remove RecursionCounter with this PR. In my opinion, we shouldn't, because the ability to limit max recursion might be useful for some users still |
It seems this PR doesn't have any significant performance impact. |
blaginin
commented
Nov 15, 2024
FYI, I marked this ready for review. @peter-toth@Eason0729, if you guys want to take a look 🌻 |
iffyio
commented
Nov 16, 2024
@blaginin thanks for looking to fix this! Currently the preference is to avoid a third-party dependency for this issue, ideally fixing up the parser behavior instead to properly handle deeply nested input. See comment here for a bit more context on rationale |
| group.bench_function("sqlparser::with_select", |b| { | ||
| b.iter(|| Parser::parse_sql(&dialect, with_query)); | ||
| }); | ||
There was a problem hiding this comment.
For large_statement, making separated test would make differentiating potential(future) regression easier.
It's a suggestion(fine to leave it as it is).
There was a problem hiding this comment.
Not sure I understood your comment, sorry. I added tests for parsing large statements in tests/sqlparser_common.rs. Do you think we should test something else?
There was a problem hiding this comment.
I thinks it would be better to add as separated test.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
@iffyio, we had done some research on stacker / recursive in apache/datafusion#13310 to verify concerns before we added it to datafusion: apache/datafusion#13310 (review) / apache/datafusion#13177 (comment) |
Eason0729
commented
Nov 16, 2024
Sorry for missing that context when reviewing. So we would like to avoid using recursive for stablility, maybe try...
|
blaginin
commented
Nov 16, 2024
Thanks for the review!! 🙂
We ended up using |
iffyio
commented
Nov 17, 2024
Ah I see, thanks for the context @peter-toth! cc @alamb for overall thoughts on adding this dependency to sqlparser? |
alamb
commented
Nov 24, 2024
While adding new dependencies in general ls 🤮 I don't think there is any viable alternative in this case We have tried to avoid doing something like I am hopeful that if we adopt this particular crate we won't have to worry about it again 🤞 |
alamb
commented
Nov 24, 2024
I think this PR needs a bit more documentation and we shoudl figure out how to rationalize with the existing https://docs.rs/sqlparser/latest/sqlparser/parser/struct.Parser.html#method.with_recursion_limit |
# Conflicts: # tests/sqlparser_common.rs
blaginin
commented
Nov 26, 2024
@alamb, I feel like
I added notes in the methods I touched; should be better now ✋ |
Eason0729
commented
Nov 28, 2024
It seems like we reached the decision to add |
alamb
left a comment
There was a problem hiding this comment.
I think it looks good -- any other thoughts @iffyio
Thank you @blaginin and @Eason0729 for pushing this along
blaginin
commented
Dec 2, 2024
Just for transparency, there's apache/datafusion#13513 raised in Datafusion but I believe it shouldn't be the reason not to merge this one (happy to be challenged) |
alamb
commented
Dec 2, 2024
Maybe we could make it an optional dependency 🤔 |
blaginin
commented
Dec 2, 2024
nice idea actually! will do |
Uh oh!
There was an error while loading. Please reload this page.
Co-authored-by: Ifeanyi Ubah <ify1992@yahoo.com>
# Conflicts: # tests/sqlparser_common.rs
blaginin
commented
Dec 6, 2024
resolved conflicts, should be good to merge now 🤗 |
alamb
commented
Dec 11, 2024
Given the potential for unintended side effects with this change, I think we should merge it in asap after we have released |
Eason0729
commented
Dec 17, 2024
Should we merge this? or something is missing in this PR. |
# Conflicts: # tests/sqlparser_common.rs
blaginin
commented
Dec 17, 2024
hey, based on the previous comment I think we want to make a release first 🙂 |
Eason0729
commented
Dec 18, 2024
Thanks. |
Sorry -- the reason I haven't previously merged this is exactly to meger it after release to give it enough "bake time" . I am glad we did wait, actually, as using this macro has caused trouble downstream in datafusion
I think we are good to go Thank you again @blaginin and @Eason0729 for your contributions and patience |
lovasoa
commented
Feb 18, 2025
Hi @alamb , @iffyio ! Just wanted to report that I just received a crash report that seems to come from here: sqlpage/SQLPage#814 |
alamb
commented
Feb 18, 2025
Thaks @lovasoa Looks like you have also reported a bug to stacker: I am glad there is a way to disable the stacker dependency in sqlparser Is there anything else you think we should do here? Thanks again |
lovasoa
commented
Feb 18, 2025
Yes, I discovered error handling is completely absent from stacker, and it just crashes the entire program with a cryptic error message when the underlying pthread library returns any error. I submitted a PR, but in the meantime, I wouldn't recommend including it by default in sqlparser, especially if the goal was to avoid crashes in the first place. |
lovasoa
commented
Feb 18, 2025
SQLPage does not have a huge install base, and it took just a few days before the first crash report. |
alamb
commented
Feb 19, 2025
DataFusion does have a pretty large user base and we haven't gotten crash reports yet that I know of. I was somewhat worried about using stacker in datafusion too until @peter-toth pointed out that it was used by rustc itself which allayed my concerns. it does seem like the usecase
Is somewhat uncommon. I don't really have a strong opinion one way or the other. |
lovasoa
commented
Feb 19, 2025
Yes, I initially thought that the problem was specific to their very restricted environment, but looking at the code in stacker, they crash the entire program on ANY error returned by any of the pthread functions used. And pthread functions can return an error code in a number of cases. |
alamb
commented
Feb 19, 2025
Interesting -- I haven't looked at the code or what functions are used (and thus under what circumstances such errors happen or how likely they are to occur) |
I didn't notice the missing error handling either. Your rust-lang/stacker#116 seems like a nice improvement. But if it doesn't get accepted for some reason, then probably we could handle errors in DF. Maybe adjust the recursive macro to run some tests before using stacker... |
alamb
commented
Feb 23, 2025
|
Closes#984, related to apache/datafusion#9375 (comment)
Todo: