You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by "SteveLauC (via GitHub)" <gi...@apache.org> on 2024/03/08 12:00:40 UTC
[I] Got `LIMIT must not be negative` error as long as it is not a literal [arrow-datafusion]
SteveLauC opened a new issue, #9506:
URL: https://github.com/apache/arrow-datafusion/issues/9506
### Describe the bug
```
$ datafusion-cli --color
DataFusion CLI v36.0.0
❯ select * from '1.parquet' limit 1 + 1;
Error during planning: LIMIT must not be negative
❯
```
It should work as long as it can be evaluated without schema or data, here is how duckdb handles it:
```
$ duckdb
v0.10.0 20b1486d11
Enter ".help" for usage hints.
Connected to a transient in-memory database.
Use ".open FILENAME" to reopen on a persistent database.
D create table foo (id int);
D select * from foo limit 1 + 1;
┌────────┐
│ id │
│ int32 │
├────────┤
│ 0 rows │
└────────┘
```
### To Reproduce
See above, the table (parquet file) should not matter.
### Expected behavior
`1 + 1` should be evaluated to constant 2.
### Additional context
Related code:
https://github.com/apache/arrow-datafusion/blob/fc81bf10ea7cde55c6d58a670e15bfd0581ec8c2/datafusion/sql/src/query.rs#L240-L257
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] Got "LIMIT must not be negative" error as long as it is not a literal [arrow-datafusion]
Posted by "jonahgao (via GitHub)" <gi...@apache.org>.
jonahgao commented on issue #9506:
URL: https://github.com/apache/arrow-datafusion/issues/9506#issuecomment-1987512263
I think ideally it should support any scalar expression.
In PostgreSQL, even functions and scalar subqueries are allowed.
```sh
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)
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] Got "LIMIT must not be negative" error as long as it is not a literal [arrow-datafusion]
Posted by "alamb (via GitHub)" <gi...@apache.org>.
alamb commented on issue #9506:
URL: https://github.com/apache/arrow-datafusion/issues/9506#issuecomment-2016951210
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 🤔
https://github.com/apache/arrow-datafusion/blob/1e4ddb6d86328cb6596bb50da9ccc654f19a83ea/datafusion/sql/src/query.rs#L249C1-L253C1
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] Got "LIMIT must not be negative" error as long as it is not a literal [arrow-datafusion]
Posted by "SteveLauC (via GitHub)" <gi...@apache.org>.
SteveLauC commented on issue #9506:
URL: https://github.com/apache/arrow-datafusion/issues/9506#issuecomment-1985581141
So if DataFusion wants to follow DuckDB's behavior, then I guess we should evaluate that `SQLExpr` rather than simply converting it to DataFusion's `Expr` type.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] Got "LIMIT must not be negative" error as long as it is not a literal [arrow-datafusion]
Posted by "SteveLauC (via GitHub)" <gi...@apache.org>.
SteveLauC commented on issue #9506:
URL: https://github.com/apache/arrow-datafusion/issues/9506#issuecomment-1987695291
> any scalar expression
Yeah, as long as it can be evaluated to a number, it should work.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] Got "LIMIT must not be negative" error as long as it is not a literal [datafusion]
Posted by "SteveLauC (via GitHub)" <gi...@apache.org>.
SteveLauC commented on issue #9506:
URL: https://github.com/apache/datafusion/issues/9506#issuecomment-5426994763
> I think ideally it should support any scalar expression. In PostgreSQL, even functions and scalar subqueries are allowed.
Yeah, scalar subquery is still not suported in DataFusion v55
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org
Re: [I] Got "LIMIT must not be negative" error as long as it is not a literal [arrow-datafusion]
Posted by "mustafasrepo (via GitHub)" <gi...@apache.org>.
mustafasrepo closed issue #9506: Got "LIMIT must not be negative" error as long as it is not a literal
URL: https://github.com/apache/arrow-datafusion/issues/9506
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org