jayzhan211 commented on code in PR #25467:
URL: https://github.com/apache/datafusion/pull/25467#discussion_r4047078989
##########
datafusion/physical-plan/src/joins/piecewise_merge_join/existence_join.rs:
##########
@@ -462,6 +476,16 @@ pub(super) fn extreme_key(values: &ArrayRef, descending:
bool) -> Result<ArrayRe
extreme.to_array_of_size(1)
}
+/// Builds the `LeftMark` `mark` column from the watermark: `false` for the
unmatched prefix
+/// `[0, min_marked)`, `true` for the matched suffix `[min_marked, len)` --
the same split
+/// `LeftSemi`/`LeftAnti` slice the buffered batch on, just kept as one column
instead of used
+/// to drop rows.
+fn mark_column(len: usize, min_marked: usize) -> ArrayRef {
+ let mut mark = vec![false; len];
+ mark[min_marked..].fill(true);
+ Arc::new(BooleanArray::from(mark))
Review Comment:
```suggestion
let mut mark = BooleanBufferBuilder::new(len);
mark.append_n(min_marked, false);
mark.append_n(len - min_marked, true);
Arc::new(BooleanArray::new(mark.finish(), None))
```
##########
datafusion/physical-plan/src/joins/piecewise_merge_join/right_existence_join.rs:
##########
@@ -325,6 +340,26 @@ impl RightExistencePWMJStream {
// latter so the stream's declared schema is what it yields.
Ok(RecordBatch::try_new(Arc::clone(&self.schema), columns)?)
}
+
+ /// Keeps every streamed row -- nothing is filtered -- and appends the
comparison against
+ /// the single buffered extreme as a `mark` column: `true` where some
buffered row
+ /// matches, `false` everywhere else, including where the streamed key is
NULL (the `mark`
+ /// column is documented never to be NULL; see `JoinType::LeftMark`).
+ fn mark_streamed_batch(&self, batch: &RecordBatch) -> Result<RecordBatch> {
+ let mark: ArrayRef = match self.matched_mask(batch)? {
+ None => Arc::new(BooleanArray::from(vec![false;
batch.num_rows()])),
Review Comment:
```suggestion
None => Arc::new(BooleanArray::new(
BooleanBuffer::new_unset(batch.num_rows()),
None,
)),
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]