jayzhan211 opened a new pull request, #26631:
URL: https://github.com/apache/datafusion/pull/26631
## Which issue does this PR close?
- None. This is a follow-up to #26570, whose cross-join tests this PR relies
on. This PR is stacked on #26570, so
only the last commit belongs to it.
## Rationale for this change
`CrossJoinExec` computes its output facts (constants, equalities, orderings)
by calling
`join_equivalence_properties` with `JoinType::Full`. A cross join never pads
rows with NULLs, so a full outer join
is the wrong model. Today this does not change any plan, because the current
outer-join rules keep the constants
that a cross join needs. But it ties cross join to rules that are about NULL
padding, and those rules are being
changed: with #26459 or #26042 merged, a query such as
```sql
SELECT l.c, s.x
FROM (SELECT c FROM t) l CROSS JOIN (SELECT x FROM small WHERE x = 1) s
ORDER BY l.c, s.x;
```
sorts on `x` again even though `x = 1` still holds after the join. The
cross-join cases added in #26570 fail with
either PR merged in.
## What changes are included in this PR?
`CrossJoinExec` now derives its equivalence properties as an inner join with
no join keys, with a comment that
says why. Nothing else changes: with no keys and no maintained input order,
an inner join and a full outer join
give the same facts under the current rules.
## What is the testing strategy for this PR?
The cross-join cases in `equivalence_properties.slt` from #26570 cover this
change. All sqllogictest files and the
join and physical optimizer tests pass unchanged. I also merged #26459 and
#26042 into this branch one at a time:
without this change the cross-join cases fail with an extra sort, and with
it they pass.
## Are there any user-facing changes?
No.
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]