| 844 | } |
| 845 | |
| 846 | RowVectorPtr NestedLoopJoinProbe::getBuildMismatchedOutput( |
| 847 | const RowVectorPtr& data, |
| 848 | const SelectivityVector& matched, |
| 849 | BufferPtr& unmatchedMapping, |
| 850 | const std::vector<IdentityProjection>& projections, |
| 851 | const std::vector<IdentityProjection>& nullProjections) { |
| 852 | // If data is all matched or the join is a cross product, there is no |
| 853 | // mismatched rows. But there is an exception that if the join is a cross |
| 854 | // product but the build or probe side is empty, there could still be |
| 855 | // mismatched rows from the other side. |
| 856 | if (matched.isAllSelected() || |
| 857 | (isCrossJoin() && !probeSideEmpty_ && !isBuildSideEmpty())) { |
| 858 | return nullptr; |
| 859 | } |
| 860 | |
| 861 | auto rawMapping = |
| 862 | initializeRowNumberMapping(unmatchedMapping, data->size(), pool()); |
| 863 | int32_t numUnmatched{0}; |
| 864 | for (auto i = 0; i < data->size(); ++i) { |
| 865 | if (!matched.isValid(i)) { |
| 866 | rawMapping[numUnmatched++] = i; |
| 867 | } |
| 868 | } |
| 869 | BOLT_CHECK_GT(numUnmatched, 0); |
| 870 | |
| 871 | std::vector<VectorPtr> projectedChildren(outputType_->size()); |
| 872 | projectChildren( |
| 873 | projectedChildren, data, projections, numUnmatched, unmatchedMapping); |
| 874 | for (auto [_, outputChannel] : nullProjections) { |
| 875 | BOLT_CHECK_GT(projectedChildren.size(), outputChannel); |
| 876 | projectedChildren[outputChannel] = BaseVector::createNullConstant( |
| 877 | outputType_->childAt(outputChannel), numUnmatched, pool()); |
| 878 | } |
| 879 | return std::make_shared<RowVector>( |
| 880 | pool(), outputType_, nullptr, numUnmatched, std::move(projectedChildren)); |
| 881 | } |
| 882 | |
| 883 | } // namespace bytedance::bolt::exec |
nothing calls this directly
no test coverage detected