-
Notifications
You must be signed in to change notification settings - Fork 568
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
Unexpected result when RIGHT JOIN
a subquery
#16951
Comments
Tested with 5.8.5 and we get the same results, so seems not related to the Hash join optimization recently added to master. |
For the first query without the filteringif I insert value
So it seems that postgres gives precedence to Additionally, for postgres it seems that when t0 & t1 are joined with the explicit
or:
|
Haven't found anything in SQL specification about this behavior. From postgres:
but this seems to not be true based on the example in the previous comment.
also contradicts with the behavior. |
For the second query with the filteringPostgres (using the syntax to ensure the same join order):
CrateDB:
There could be an issue with CrateDB and the fact that the filtering in WHERE clause is pushed down to the Collect, where it seems it should stay on top of everything? (after the right join) but:
|
After some more investigation together with @mkleen (thx), the issue drills down to the NL Join iterators, for the RIGHT JOIN:
it shouldn't return anything, as the left side (
|
Checking this more, I think the previous statement is not correct. psql:
or simpler (since t1 has no rows):
so we need to emit even if the left table (or subselect) returns 0 rows. So we turn back to the original issue that the
So for CrateDB, not only we shouldn't push down that filter to Collect of
|
CrateDB version
CrateDB 5.10.0-SNAPSHOT built 87c6dfa
CrateDB setup information
Manual build following the instructions here: https://github.com/crate/crate/blob/master/devs/docs/basics.rst
Problem description
Consider the following test case. The third query returns an unexpected result: The second query returns
NULL NULL 1
, and the third query with the filter which is the negation should return an empty set. However, one row is fetched.Besides, PostgreSQL returns
'' NULL 1
for the first query.Steps to Reproduce
Actual Result
As mentioned above
Expected Result
As mentioned above.
The text was updated successfully, but these errors were encountered: