Skip to content

Commit

Permalink
fix(joins): Strengthen nullptr check for null aware hash joins with f…
Browse files Browse the repository at this point in the history
…ilters (facebookincubator#11620)

Summary:

The mayHaveNulls() method sometimes returns true when there are in fact no nulls. This change will make sure that a nullptr isn't passed to memcpy.

Differential Revision: D66333546
  • Loading branch information
Daniel Hunte authored and facebook-github-bot committed Nov 21, 2024
1 parent 2e0b2d7 commit f3dc691
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions velox/exec/HashProbe.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1212,11 +1212,12 @@ void HashProbe::prepareFilterRowsForNullAwareJoin(
for (auto& projection : filterInputProjections_) {
filterInputColumnDecodedVector_.decode(
*filterInput->childAt(projection.outputChannel), filterInputRows_);
if (filterInputColumnDecodedVector_.mayHaveNulls()) {
if (const uint64_t* nulls =
filterInputColumnDecodedVector_.nulls(&filterInputRows_)) {
SelectivityVector nullsInActiveRows(numRows);
memcpy(
nullsInActiveRows.asMutableRange().bits(),
filterInputColumnDecodedVector_.nulls(&filterInputRows_),
nulls,
bits::nbytes(numRows));
// All rows that are not active count as non-null here.
bits::orWithNegatedBits(
Expand Down

0 comments on commit f3dc691

Please sign in to comment.