Skip to content

Commit

Permalink
Adding filtered cases for other tests
Browse files Browse the repository at this point in the history
  • Loading branch information
edmondop committed Jun 4, 2024
1 parent 1f6e525 commit bc330b9
Showing 1 changed file with 63 additions and 2 deletions.
65 changes: 63 additions & 2 deletions datafusion/core/tests/fuzz_cases/join_fuzz.rs
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,18 @@ async fn test_left_join_1k() {
.await
}

#[tokio::test]
async fn test_left_join_1k_filtered() {
JoinFuzzTestCase::new(
make_staggered_batches(1000),
make_staggered_batches(1000),
JoinType::Left,
Some(Box::new(less_than_10_join_filter)),
)
.run_test()
.await
}

#[tokio::test]
async fn test_right_join_1k() {
JoinFuzzTestCase::new(
Expand All @@ -118,6 +130,17 @@ async fn test_right_join_1k() {
.run_test()
.await
}
#[tokio::test]
async fn test_right_join_1k_filtered() {
JoinFuzzTestCase::new(
make_staggered_batches(1000),
make_staggered_batches(1000),
JoinType::Right,
Some(Box::new(less_than_10_join_filter)),
)
.run_test()
.await
}

#[tokio::test]
async fn test_full_join_1k() {
Expand All @@ -131,6 +154,18 @@ async fn test_full_join_1k() {
.await
}

#[tokio::test]
async fn test_full_join_1k_filtered() {
JoinFuzzTestCase::new(
make_staggered_batches(1000),
make_staggered_batches(1000),
JoinType::Full,
Some(Box::new(less_than_10_join_filter)),
)
.run_test()
.await
}

#[tokio::test]
async fn test_semi_join_1k() {
JoinFuzzTestCase::new(
Expand All @@ -143,6 +178,18 @@ async fn test_semi_join_1k() {
.await
}

#[tokio::test]
async fn test_semi_join_1k_filtered() {
JoinFuzzTestCase::new(
make_staggered_batches(1000),
make_staggered_batches(1000),
JoinType::LeftSemi,
Some(Box::new(less_than_10_join_filter)),
)
.run_test()
.await
}

#[tokio::test]
async fn test_anti_join_1k() {
JoinFuzzTestCase::new(
Expand All @@ -155,20 +202,34 @@ async fn test_anti_join_1k() {
.await
}

#[tokio::test]
async fn test_anti_join_1k_filtered() {
JoinFuzzTestCase::new(
make_staggered_batches(1000),
make_staggered_batches(1000),
JoinType::LeftAnti,
Some(Box::new(less_than_10_join_filter)),
)
.run_test()
.await
}

type JoinFilterBuilder = Box<dyn Fn(Arc<Schema>, Arc<Schema>) -> JoinFilter>;

struct JoinFuzzTestCase {
batch_sizes: &'static [usize],
input1: Vec<RecordBatch>,
input2: Vec<RecordBatch>,
join_type: JoinType,
join_filter_builder: Option<Box<dyn Fn(Arc<Schema>, Arc<Schema>) -> JoinFilter>>,
join_filter_builder: Option<JoinFilterBuilder>,
}

impl JoinFuzzTestCase {
fn new(
input1: Vec<RecordBatch>,
input2: Vec<RecordBatch>,
join_type: JoinType,
join_filter_builder: Option<Box<dyn Fn(Arc<Schema>, Arc<Schema>) -> JoinFilter>>,
join_filter_builder: Option<JoinFilterBuilder>,
) -> Self {
Self {
batch_sizes: &[1, 2, 7, 49, 50, 51, 100],
Expand Down

0 comments on commit bc330b9

Please sign in to comment.