diff --git a/velox/exec/MergeJoin.cpp b/velox/exec/MergeJoin.cpp index 2dc3b1c43f8a..a8bea808c40d 100644 --- a/velox/exec/MergeJoin.cpp +++ b/velox/exec/MergeJoin.cpp @@ -331,6 +331,14 @@ void MergeJoin::flattenRightProjections() { newFlat->copy(currentVector.get(), 0, 0, outputSize_); children[projection.outputChannel] = std::move(newFlat); } + + if (filter_ != nullptr && filterInput_ != nullptr) { + auto& filterInputChildren = filterInput_->children(); + for (const auto [filterInputChannel, outputChannel] : + filterInputToOutputChannel_) { + filterInputChildren[filterInputChannel] = children[outputChannel]; + } + } isRightFlattened_ = true; }