This is an automated email from the ASF dual-hosted git repository.

comphead pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/datafusion.git


The following commit(s) were added to refs/heads/main by this push:
     new 46101f3d19 Replace `BooleanArray::extend` with `append_n` (#13832)
46101f3d19 is described below

commit 46101f3d195d1f8b483e13f2d19485e04070e0b0
Author: Oleks V <[email protected]>
AuthorDate: Wed Dec 18 18:07:55 2024 -0800

    Replace `BooleanArray::extend` with `append_n` (#13832)
---
 .../physical-plan/src/joins/sort_merge_join.rs       | 20 +++++++++-----------
 1 file changed, 9 insertions(+), 11 deletions(-)

diff --git a/datafusion/physical-plan/src/joins/sort_merge_join.rs 
b/datafusion/physical-plan/src/joins/sort_merge_join.rs
index 43f698c24d..5e387409da 100644
--- a/datafusion/physical-plan/src/joins/sort_merge_join.rs
+++ b/datafusion/physical-plan/src/joins/sort_merge_join.rs
@@ -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 => {
@@ -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 => {
@@ -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 => {
@@ -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]);
@@ -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]);


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to