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

Method doGetOutput

bolt/exec/MergeJoin.cpp:958–1293  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

956
957 return nullptr;
958 }
959}
960
961RowVectorPtr MergeJoin::doGetOutput() {
962 // Check if we ran out of space in the output vector in the middle of the
963 // match.
964 if (leftMatch_ && leftMatch_->cursor) {
965 BOLT_CHECK(rightMatch_ && rightMatch_->cursor);
966
967 // Not all rows from the last match fit in the output. Continue producing
968 // results from the current match.
969 if (addToOutput()) {
970 previousLeftMatch_ = leftMatch_;
971 return std::move(output_);
972 } else {
973 previousLeftMatch_ = leftMatch_;
974 }
975 }
976
977 // There is no output-in-progress match, but there could be incomplete
978 // match.
979 if (leftMatch_) {
980 BOLT_CHECK(rightMatch_);
981
982 if (input_) {
983 // Look for continuation of a match on the left and/or right sides.
984 if (!findEndOfMatch(leftMatch_.value(), input_, leftKeys_)) {
985 // Continue looking for the end of the match.
986 input_ = nullptr;
987 return nullptr;
988 }
989
990 if (leftMatch_->inputs.back() == input_) {
991 index_ = leftMatch_->endIndex;
992 }
993 } else if (noMoreInput_) {
994 leftMatch_->complete = true;
995 } else {
996 // Need more input.
997 return nullptr;
998 }
999
1000 if (rightInput_) {
1001 if (!findEndOfMatch(rightMatch_.value(), rightInput_, rightKeys_)) {
1002 // Continue looking for the end of the match.
1003 rightInput_ = nullptr;
1004 return nullptr;
1005 }
1006 if (rightMatch_->inputs.back() == rightInput_) {
1007 if (isFullJoin(joinType_) || isRightJoin(joinType_)) {
1008 rightIndex_ = rightMatch_->endIndex;
1009 } else {
1010 rightIndex_ =
1011 firstNonNull(rightInput_, rightKeys_, rightMatch_->endIndex);
1012 if (rightIndex_ == rightInput_->size()) {
1013 rightInput_ = nullptr;
1014 }
1015 }

Callers

nothing calls this directly

Calls 13

isFullJoinFunction · 0.85
isRightJoinFunction · 0.85
firstNonNullFunction · 0.85
isLeftJoinFunction · 0.85
isAntiJoinFunction · 0.85
loadColumnsFunction · 0.85
backMethod · 0.80
compareFunction · 0.70
valueMethod · 0.45
sizeMethod · 0.45
resizeMethod · 0.45
execCtxMethod · 0.45

Tested by

no test coverage detected