Skip to content

Fix bug while merging RecordBatch, add SortPreservingMerge fuzz tester - #1678

Merged
alamb merged 2 commits into
apache:masterfrom
alamb:alamb/merge_fuzz
Jan 27, 2022
Merged

Fix bug while merging RecordBatch, add SortPreservingMerge fuzz tester#1678
alamb merged 2 commits into
apache:masterfrom
alamb:alamb/merge_fuzz

Conversation

@alamb

@alambalamb commented Jan 25, 2022

Copy link
Copy Markdown
Contributor

Which issue does this PR close?

Fixes#1676

Includes the code from @yjshenalamb#4 in a separate commit ❤️

Rationale for this change

Despite pretty good testing in SortPreservingMerge there was at least one case that is not yet covered. This PR adds

What changes are included in this PR?

  1. A "fuzz" tester that tests merging various combinations of streams (broken into multiple batches, as well as various ranges)
  2. Includes the code from @yjshenskip empty batch while inserting alamb/datafusion#4 in a separate commit that fixesRegression: Merge assertion: 'assertion failed: i < self.len()' in array_primitive.rs while merging non overlapping streams #1676

Are there any user-facing changes?

Bug is fixed

@alamb

Copy link
Copy Markdown
ContributorAuthor

Marking as a draft as I still plan to add a few more cases to this tester (as I work on #1676 )

@alambalamb changed the title Add SortPreservingMerge fuzz testerFix bug while merging RecordBatch, Add SortPreservingMerge fuzz testerJan 26, 2022
return Poll::Ready(Ok(()));
}
let mut streams = self.streams.streams.lock().unwrap();
let mut empty_batch = false;

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The changes to this file are easier to see if you use a whitespace blind diff:
https://github.com/apache/arrow-datafusion/pull/1678/files?w=1

}

#[tokio::test]
async fn test_merge_2_no_overlap() {

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this test fails without the changes to datafusion/src/physical_plan/sorts/sort_preserving_merge.rs

@alamb
alamb marked this pull request as ready for review January 26, 2022 15:59
@alambalamb changed the title Fix bug while merging RecordBatch, Add SortPreservingMerge fuzz testerFix bug while merging RecordBatch, add SortPreservingMerge fuzz testerJan 26, 2022

@houqphouqp left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bugSomething isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Regression: Merge assertion: 'assertion failed: i < self.len()' in array_primitive.rs while merging non overlapping streams

3 participants

@alamb@houqp@yjshen