| 394 | } |
| 395 | |
| 396 | void MergeJoin::addOutputRow( |
| 397 | const RowVectorPtr& left, |
| 398 | vector_size_t leftIndex, |
| 399 | const RowVectorPtr& right, |
| 400 | vector_size_t rightIndex, |
| 401 | bool isRightJoinForFullOuter) { |
| 402 | // All left side projections share the same dictionary indices (leftIndices_). |
| 403 | rawLeftIndices_[outputSize_] = leftIndex; |
| 404 | |
| 405 | // The right side projections can be a dictionary, of flat in case they |
| 406 | // crossed a buffer boundary. In the latter case, row values need to be |
| 407 | // copied. |
| 408 | if (!isRightFlattened_) { |
| 409 | // All right side projections share the same dictionary indices |
| 410 | // (rightIndices_). |
| 411 | rawRightIndices_[outputSize_] = rightIndex; |
| 412 | } else { |
| 413 | copyRow(right, rightIndex, output_, outputSize_, rightProjections_); |
| 414 | } |
| 415 | |
| 416 | if (filter_) { |
| 417 | copyRow(left, leftIndex, filterInput_, outputSize_, filterLeftInputs_); |
| 418 | copyRow(right, rightIndex, filterInput_, outputSize_, filterRightInputs_); |
| 419 | |
| 420 | if (joinTracker_) { |
| 421 | if (isRightJoin(joinType_) || isRightSemiFilterJoin(joinType_) || |
| 422 | (isFullJoin(joinType_) && isRightJoinForFullOuter)) { |
| 423 | // Record right-side row with a match on the left-side. |
| 424 | joinTracker_->addMatch( |
| 425 | right, rightIndex, outputSize_, isRightJoinForFullOuter); |
| 426 | } else { |
| 427 | // Record left-side row with a match on the right-side. |
| 428 | joinTracker_->addMatch( |
| 429 | left, leftIndex, outputSize_, isRightJoinForFullOuter); |
| 430 | } |
| 431 | } |
| 432 | } else if ( |
| 433 | isAntiJoin(joinType_) || isLeftSemiFilterJoin(joinType_) || |
| 434 | (isFullJoin(joinType_) && !isRightJoinForFullOuter)) { |
| 435 | // Anti join needs to track the left side rows that have no match on the |
| 436 | // right. |
| 437 | BOLT_CHECK(joinTracker_); |
| 438 | // Record left-side row with a match on the right-side. |
| 439 | joinTracker_->addMatch( |
| 440 | left, leftIndex, outputSize_, isRightJoinForFullOuter); |
| 441 | } else if ( |
| 442 | isRightSemiFilterJoin(joinType_) || |
| 443 | (isFullJoin(joinType_) && isRightJoinForFullOuter)) { |
| 444 | BOLT_CHECK(joinTracker_); |
| 445 | // Record left-side row with a match on the right-side. |
| 446 | joinTracker_->addMatch( |
| 447 | right, rightIndex, outputSize_, isRightJoinForFullOuter); |
| 448 | } |
| 449 | |
| 450 | ++outputSize_; |
| 451 | } |
| 452 | |
| 453 | bool MergeJoin::prepareOutput( |
nothing calls this directly
no test coverage detected