-
Notifications
You must be signed in to change notification settings - Fork 594
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
bug: t1.count() + t2.count()
only uses t1
#7655
Comments
t1.count() + t2.count()
uses values from t1t1.count() + t2.count()
only uses t1
What would be the equivalent SQL for |
This does actually seem to work in shell.duckdb.org to add scalar to scalar: SELECT
(SELECT count(*) FROM 'https://shell.duckdb.org/data/tpch/0_01/parquet/lineitem.parquet') +
(SELECT count(*) FROM 'https://shell.duckdb.org/data/tpch/0_01/parquet/customer.parquet'); or to add a scalar with a vector: SELECT
(SELECT count(*) FROM 'https://shell.duckdb.org/data/tpch/0_01/parquet/lineitem.parquet') + c_custkey
FROM 'https://shell.duckdb.org/data/tpch/0_01/parquet/customer.parquet'; But perhaps this doesn't work in all backends? |
This is now achievable with our new-in-9.0
The naked |
@cpcloud isn't .count() always a scalar? I definitely assumed it was, I think (no evidence) that others will think the same thing, especially if coming from pandas/python world, where semantically thye think |
|
This issue also isn't super well motivated. Is there some concrete use case here? |
Also your examples using sql are exactly what calling |
I think this is best we can do for now without a more strongly motivated use case or reasons why combining two scalar expressions in arbitrary ways must "just work". It might help to list out the ways in which scalars can currently be used and then define semantics for those operations. |
Not at a computer right now to test, but one example of a scalar from one table needing to interact with another table is a "manual autoincrement": |
In SQL, is my assumption correct that you can combine two scalar expressions in arbitrary ways? |
Closing since this now works when doing. In [8]: union = good.count().as_scalar() + bad.count().as_scalar()
In [9]: union
Out[9]:
┌─────┐
│ 344 │
└─────┘ xref: #10124 (comment) |
What happened?
If I use two unrelated tables:
then I get
RelationError: Selection expressions don't fully originate from dependencies of the table expression.
instead. I would expect this to work.What version of ibis are you using?
7.1.0
What backend(s) are you using, if any?
NA
Relevant log output
No response
Code of Conduct
The text was updated successfully, but these errors were encountered: