| 859 | |
| 860 | // Some, but not all rows passed. |
| 861 | return wrapAndCombineDict(numPassed, indices, output); |
| 862 | } |
| 863 | |
| 864 | RowVectorPtr MergeJoin::getOutput() { |
| 865 | // Make sure to have is-blocked or needs-input as true if returning null |
| 866 | // output. Otherwise, Driver assumes the operator is finished. |
| 867 | |
| 868 | // Use Operator::noMoreInput() as a no-more-input-on-the-left indicator and a |
| 869 | // noMoreRightInput_ flag as no-more-input-on-the-right indicator. |
| 870 | |
| 871 | // TODO Finish early if ran out of data on either side of the join. |
| 872 | |
| 873 | for (;;) { |
| 874 | auto output = doGetOutput(); |
| 875 | if (output != nullptr && output->size() > 0) { |
| 876 | if (filter_) { |
| 877 | output = applyFilter(output); |
| 878 | |
| 879 | if (output != nullptr) { |
| 880 | for (const auto& [channel, _] : filterInputToOutputChannel_) { |
| 881 | filterInput_->childAt(channel).reset(); |
| 882 | } |
| 883 | return output; |
| 884 | } |
| 885 | |
| 886 | // No rows survived the filter. Get more rows. |
| 887 | continue; |
| 888 | } else if (isAntiJoin(joinType_)) { |
| 889 | output = filterOutputForAntiJoin(output); |
| 890 | if (output != nullptr && output->size() > 0) { |
| 891 | return output; |
| 892 | } |
| 893 | |
| 894 | // No rows survived the filter for anti join. Get more rows. |
| 895 | continue; |
| 896 | } else if ( |
| 897 | isLeftSemiFilterJoin(joinType_) || isRightSemiFilterJoin(joinType_)) { |
| 898 | output = filterOutputForSemiJoin(output); |
| 899 | if (output != nullptr && output->size() > 0) { |
| 900 | return output; |
| 901 | } |
| 902 | |
| 903 | // No rows survived the filter for anti join. Get more rows. |
| 904 | continue; |
| 905 | } else { |
| 906 | return output; |
| 907 | } |
| 908 | } |
| 909 | |
| 910 | // Check if we need to get more data from the right side. |
| 911 | if (!noMoreRightInput_ && !futureRightSideInput_.valid() && !rightInput_) { |
| 912 | if (!rightSource_) { |
| 913 | rightSource_ = operatorCtx_->task()->getMergeJoinSource( |
| 914 | operatorCtx_->driverCtx()->splitGroupId, planNodeId()); |
| 915 | } |
| 916 | |
| 917 | while (!noMoreRightInput_ && !rightInput_) { |
| 918 | auto blockingReason = |
nothing calls this directly
no test coverage detected