Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Minor: Replace BooleanArray::extend with append_n #13832

Merged
merged 1 commit into from
Dec 19, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 9 additions & 11 deletions datafusion/physical-plan/src/joins/sort_merge_join.rs
Original file line number Diff line number Diff line change
Expand Up @@ -856,8 +856,7 @@ fn get_corrected_filter_mask(
}

// Generate null joined rows for records which have no matching join key
let null_matched = expected_size - corrected_mask.len();
corrected_mask.extend(vec![Some(false); null_matched]);
corrected_mask.append_n(expected_size - corrected_mask.len(), false);
Some(corrected_mask.finish())
}
JoinType::LeftMark => {
Expand All @@ -879,8 +878,7 @@ fn get_corrected_filter_mask(
}

// Generate null joined rows for records which have no matching join key
let null_matched = expected_size - corrected_mask.len();
corrected_mask.extend(vec![Some(false); null_matched]);
corrected_mask.append_n(expected_size - corrected_mask.len(), false);
Some(corrected_mask.finish())
}
JoinType::LeftSemi => {
Expand Down Expand Up @@ -922,9 +920,9 @@ fn get_corrected_filter_mask(
corrected_mask.append_null();
}
}

let null_matched = expected_size - corrected_mask.len();
corrected_mask.extend(vec![Some(true); null_matched]);
// Generate null joined rows for records which have no matching join key,
// for LeftAnti non-matched considered as true
corrected_mask.append_n(expected_size - corrected_mask.len(), true);
Some(corrected_mask.finish())
}
JoinType::Full => {
Expand Down Expand Up @@ -1569,10 +1567,10 @@ impl SortMergeJoinStream {
let num_rows = record_batch.num_rows();
self.output_record_batches
.filter_mask
.extend(&BooleanArray::from(vec![None; num_rows]));
.append_nulls(num_rows);
self.output_record_batches
.row_indices
.extend(&UInt64Array::from(vec![None; num_rows]));
.append_nulls(num_rows);
self.output_record_batches
.batch_ids
.extend(vec![0; num_rows]);
Expand Down Expand Up @@ -1613,10 +1611,10 @@ impl SortMergeJoinStream {

self.output_record_batches
.filter_mask
.extend(&BooleanArray::from(vec![None; num_rows]));
.append_nulls(num_rows);
self.output_record_batches
.row_indices
.extend(&UInt64Array::from(vec![None; num_rows]));
.append_nulls(num_rows);
self.output_record_batches
.batch_ids
.extend(vec![0; num_rows]);
Expand Down
Loading