MCPcopy Create free account
hub / github.com/bytedance/bolt / getBuildMismatchedOutput

Method getBuildMismatchedOutput

bolt/exec/NestedLoopJoinProbe.cpp:846–881  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

844}
845
846RowVectorPtr 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

Callers

nothing calls this directly

Calls 7

projectChildrenFunction · 0.85
isAllSelectedMethod · 0.80
isValidMethod · 0.80
childAtMethod · 0.80
poolFunction · 0.50
sizeMethod · 0.45

Tested by

no test coverage detected