void npoint_mlpack::UnorderedMultiMatcher::ComputeBaseCase(NptNode* nodeA, NptNode* nodeB, std::vector<NptNode*>& nodeC_list, PartialResult& result) { std::vector<NptNode*> node_list(3); node_list[0] = nodeA; node_list[1] = nodeB; for (unsigned int i = 0; i < nodeC_list.size(); i++) { node_list[2] = nodeC_list[i]; NodeTuple this_tuple(node_list); ComputeBaseCase(this_tuple, result); } }
/** * @brief Advance the row iterator until value changes in terms of the join * clauses * @return the end row number, [start_row, end_row) are the rows of the same * value * if the end_row == start_row, the subset is empty */ size_t MergeJoinExecutor::Advance(LogicalTile *tile, size_t start_row, bool is_left) { size_t end_row = start_row + 1; size_t this_row = start_row; size_t tuple_count = tile->GetTupleCount(); if (start_row >= tuple_count) return start_row; while (end_row < tuple_count) { expression::ContainerTuple<executor::LogicalTile> this_tuple(tile, this_row); expression::ContainerTuple<executor::LogicalTile> next_tuple(tile, end_row); bool diff = false; for (auto &clause : *join_clauses_) { // Go through each join clauses auto expr = is_left ? clause.left_.get() : clause.right_.get(); peloton::Value this_value = expr->Evaluate(&this_tuple, &this_tuple, executor_context_); peloton::Value next_value = expr->Evaluate(&next_tuple, &next_tuple, executor_context_); if (this_value.Compare(next_value) != 0) { diff = true; break; } } if (diff) { break; } // the two tuples are the same, we advance by 1 this_row = end_row; end_row++; } LOG_TRACE("Advanced %s with subset size %lu ", is_left ? "left" : "right", end_row - start_row); return end_row; }