fix: Normalize CollectLeft Joins and similar - #583
Conversation
|
👋🏽 Left comments in the other PR which are relevant in this one #582 |
…l->HashJoin,Parititioned,Full
Comments addressed. I'm now normalizing Full HashExec joins and ensuring the |
There was a problem hiding this comment.
This is looking very good!
Just some minor comments, I'd like to have @jayshrivastava chime in as well as he provided very useful comments here.
gabotechs
left a comment
There was a problem hiding this comment.
Flushing a couple more comments as I go
cb5ca44 to
e452e3a
Compare
Thanks @gabotechs! CI should be green now. (I changed |
|
Github runners are not in the mood today… |
|
Seems like the @barbarj, unless you have a better idea, I think we can omit asserting the plan snapshot there. |
I've got nothing better. Removed! |
Closes #563
(This is the plan-fix and tests part of #582)
The bug in 563 is actually a failure to enforce a plan shape invariant for multi-task stages: for every stage, executing its plan once per task over the per-task input assignment and unioning the outputs must be equivalent to executing it once over all the data.
This PR applies fixes for the problematic shapes (normalize_collect_joins.rs). Enforcing this invariant will be handled separately. (See discussion in #582).
There are 5 invalid plan shapes to fix. The following strategies are used:
CollectLeft(join types: Left/LeftSemi/LeftAnti/LeftMark/Full) → changeCollectLeft->Partitioned(keys exist; no replication needed)CollectLeft,null_aware(join type: LeftAnti) -> cap at 1 taskThe
CollectLeft->Partitionedchange causes the rewriting of a bunch of plan shapes in the plan tests. The problematic stages run over small data, and thus collapse to a single task duringprepare_network_boundaries, avoiding the bug. Due to the shape normalization pass necessarily running before task counts are decided, we can't see that the task consolidation will happen and must modify the plan.In-repo benchmarks show equivalent or better performance for all queries, save one: TPCH q22. It drops by about 40% (~17ms -> ~24ms on my machine, 8 workers, 2 threads). As far as I can tell, it's losing a dynamic filter due to being cut into more stages.