-
Notifications
You must be signed in to change notification settings - Fork 217
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: Don't panic on nested group
#4037
Conversation
No, we cannot talk about cid in error messages. I do think it is actually better we panic here, since this is a bug. Re nested group: it makes sense on the semantic level, so I think it should be allowed and supported. Justification for why it makes sense: Also, these two are equivalent: from x
group {a, b} some_pipeline from x
group {a} (
group {b} some_pipeline
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should either:
- keep the panic in this case, or
- bail earlier when encountering a nested group. This could probably be done easiest during flattening.
Since we're looking at the 1. The original "nested group" query.This was generated by an attempt to determine "What's the most popular song for each city" in #2947. The
2. The un-nested queryMax suggested this alternative in #3490 (comment). The 0.11.2 Playground gives this error:
3. The "bad PRQL program" queryThe original query at #3870 was simplified, and spawned the "bad PRQL program" conversation in #3832. That conversation clarified that the Binder Error was because there was no "name" column in the simplified example. That said, the 0.11.2 Playground panics with this query. (It may not be a different test case from #1 above)
|
I agree the proposed error message is no better than something saying "undefined error" But returning an error rather than a panic is much better imo — for example, at one point a panic would take down the ClickHouse database process (I'm not sure whether that's still the case). So I think we should try and do "undefined error"-like messages rather than panics. What's the case for panicking? (That it reminds us we have a bug? Maybe somewhat legit, but can we use the issue tracker / |
Yes, good point, I think I agree (at least in that case, I'm trying to think through whether there are other cases that would pose a problem, but agree in concept) |
@aljazerzen gentle ping on this! |
So we do have some parts of the codebase that are "proof of concept" implementation, namely lowering. This means that not all cases are covered and tested and that there will be panics. Long-term this would be solved by fuzzing, but for now I don't think we can find all of the bugs manually. This means that there will be panics and now we have two options:
|
Maybe because the code base have many calls to the |
Yes, @vanillajonathan that is exactly the problem and the best solution would be to remove the unwraps in favor or proper error messages. |
Yes, this would be great I think, nice idea re
Not sure there are any real cases where it's worse? |
I'm saying that there is a lot of strange cases that would still panic and not be any better than the status quo. |
I agree the My main point is that if there are functions that already return |
(if you agree, mark the PR as approved and we can merge...) |
Oh, I've forgotten I've "requested changes" here. Having FYI: I don't think we have functions that don't return |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, you've already included GH issue number :D
A small change to avoid the panic. Still a bad error message.
I haven't thought about whether this should work. Assuming it shouldn't, we can close #3870, now it's replaced with the bad error message test