-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Got "LIMIT must not be negative" error as long as it is not a literal #9506
Comments
LIMIT must not be negative
error as long as it is not a literal
So if DataFusion wants to follow DuckDB's behavior, then I guess we should evaluate that |
I think ideally it should support any scalar expression. psql=> select * from t limit (select * from t limit 1);
a
---
1
(1 row)
psql=> select * from t limit random() + 1;
a
---
1
(1 row) |
Yeah, as long as it can be evaluated to a number, it should work. |
I think we could run the Expr simplifier / const folder on the limit value I am not sure we can do so from within the planner itself 🤔 |
Describe the bug
It should work as long as it can be evaluated without schema or data, here is how duckdb handles it:
To Reproduce
See above, the table (parquet file) should not matter.
Expected behavior
1 + 1
should be evaluated to a constant 2.Additional context
Related code:
https://github.com/apache/arrow-datafusion/blob/fc81bf10ea7cde55c6d58a670e15bfd0581ec8c2/datafusion/sql/src/query.rs#L240-L257
The text was updated successfully, but these errors were encountered: