konstantinb commented on PR #6885:
URL: https://github.com/apache/hive/pull/6885#issuecomment-6220075346
would it also make sense to add negative tests for RIGHT and FULL joins with
an aggregate on the left, grouped on the join key? The ticket says these were
never affected because perform() returns early for anything other than INNER or
LEFT. The new guard now blocks them one step earlier, in onMatch. Pin both
paths so a future change to either can't silently start rewriting these joins.
The test could follow the assertUnchanged pattern used by the LEFT tests,
with RIGHT and FULL as the join types.
For a qtest, something like this should return the correct results with CBO
on and off (by hand: 4 and 5 rows respectively):
```
with t1 as (select stack(3, 1, 1, 2) as (k)),
t2 as (select stack(4, 1, 1, 3, 4) as (k))
select count(*) from (select distinct k from t1) a right join t2 b on a.k =
b.k;
with t1 as (select stack(3, 1, 1, 2) as (k)),
t2 as (select stack(4, 1, 1, 3, 4) as (k))
select count(*) from (select distinct k from t1) a full join t2 b on a.k =
b.k;
```
Note that the aggregate-on-right case (RIGHT/FULL with the aggregate on the
right) is still guarded only by perform()'s early return, since the new check
is on the swap rule. A test for that orientation would cover it too.
--
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]