You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Intermittent failures in fuzz_cases::join_fuzz::test_anti_join_1k_filtered #11555
I found the problem happens if for 1 stream row there are multiple matched buffered rows, but those buffered rows are in separate batches. In this case the datafusion SMJ reacts on the first batch without knowing the next one is coming. I'm still experimenting to find a solution even a hacky one
well the problem is AntiJoin needs to wait for the very last right batch to read for the respective left row.
I tried couple of options how to identify the very last right batch,
self.buffered_data.scanning_offset == 0
or
self.buffered_data.scanning_finished()
But each of them has its own false positives or false negatives. Perhaps we need a separate function or index to calculate the very last batch. @korowa do you have any other ideas on that, as you contributed a lot to SMJ, appreciate if you can help
From what I remember -- doesn't SMJ already fetches buffered side until it meets the first key which is non-equal to the current streamed side value (PollingRest buffered state)? It seems to be a solution for waiting the last batch for the key -- for any type (normal/semi/anti) of join, on start of streamed row processing, all required rows from the buffered side should be already read and stored in memory.
Get all matched batches for particular streaming row
Increase counter when freeze_streamed called until we hit matched batches length, so presumably processed all the data.
But this approach has a flaw, namely
for given streamed row like in test above: for (0, 30) key there are 2 matches batches, but the way freeze_streamed called is not determenistic.
So for (0, 30) there are 2 batches, 3 matched rows each.
Sometimes thery are processed in 6 calls, 1 buffered row per call. sometimes 1 call for 3 rows, and then 3 calls per 1 buffered row.
Activity
alamb commentedon Jul 19, 2024
Could potentially be related to #11535
alamb commentedon Jul 19, 2024
Note the test passes on re-run for PR #11527:
Failure: https://github.com/apache/datafusion/actions/runs/10001535587/job/27645407724?pr=11527
Pass (same code): https://github.com/apache/datafusion/actions/runs/10001535587/job/27681929975?pr=11527
comphead commentedon Jul 22, 2024
I think the nature can be similar to https://github.com/apache/datafusion/pull/11041/files#r1648318160
I'll do a fix, thanks @alamb for reporting it
alamb commentedon Jul 22, 2024
🤔 it seems to have happened again on main right after #11604 was merged:
https://github.com/apache/datafusion/actions/runs/10046115241/job/27764888311
comphead commentedon Jul 22, 2024
I have disabled the test for now. I'll spend more time on investigation why this happens
comphead commentedon Jul 25, 2024
I'm still on it. It has a pretty tricky condition for cross buffered batches.
UPD: I built a repro, working on solution
comphead commentedon Jul 28, 2024
I found the problem happens if for 1 stream row there are multiple matched buffered rows, but those buffered rows are in separate batches. In this case the datafusion SMJ reacts on the first batch without knowing the next one is coming. I'm still experimenting to find a solution even a hacky one
comphead commentedon Jul 29, 2024
the repro test case
comphead commentedon Aug 8, 2024
Attached more accurate test case
comphead commentedon Aug 13, 2024
well the problem is AntiJoin needs to wait for the very last right batch to read for the respective left row.
I tried couple of options how to identify the very last right batch,
But each of them has its own false positives or false negatives. Perhaps we need a separate function or index to calculate the very last batch. @korowa do you have any other ideas on that, as you contributed a lot to SMJ, appreciate if you can help
korowa commentedon Aug 15, 2024
From what I remember -- doesn't SMJ already fetches buffered side until it meets the first key which is non-equal to the current streamed side value (
PollingRestbuffered state)? It seems to be a solution for waiting the last batch for the key -- for any type (normal/semi/anti) of join, on start of streamed row processing, all required rows from the buffered side should be already read and stored in memory.Or maybe I've mistunderstood the problem?
comphead commentedon Aug 16, 2024
Thanks @korowa that is something I'm also trying, I hope to make a PR soon adding you as a reviewer
comphead commentedon Aug 23, 2024
I think this local test may cover lots of cases
My initial thought was to do like :
freeze_streamedcalled until we hit matched batches length, so presumably processed all the data.But this approach has a flaw, namely
for given streamed row like in test above: for (0, 30) key there are 2 matches batches, but the way
freeze_streamedcalled is not determenistic.So for (0, 30) there are 2 batches, 3 matched rows each.
Sometimes thery are processed in 6 calls, 1 buffered row per call. sometimes 1 call for 3 rows, and then 3 calls per 1 buffered row.
comphead commentedon Nov 5, 2024
This can be closed