/**
 * In some case, outer join results can be determined only after all inner
 * join results are constructed, because, in order to build outer join result,
 * we need to know the rows from one side that cannot be matched by rows from
 * the other side. If inner join part has not finished, we cannot know whether
 * there will be a match later.
 */
bool AbstractJoinExecutor::BuildOuterJoinOutput() {
  PL_ASSERT(join_type_ != JoinType::INVALID);

  switch (join_type_) {
    case JoinType::LEFT: { return BuildLeftJoinOutput(); }

    case JoinType::RIGHT: { return BuildRightJoinOutput(); }

    case JoinType::OUTER: {
      bool status = BuildLeftJoinOutput();

      if (status == true) {
        return status;
      } else {
        return BuildRightJoinOutput();
      }
      break;
    }

    case JoinType::INNER: { return false; }

    default: {
      throw Exception("Unsupported join type : " + JoinTypeToString(join_type_));
      break;
    }
  }

  return false;
}
Beispiel #2
0
std::ostream &operator<<(std::ostream &stream, const JoinDefinition &ob)
{
	stream << "JoinDefinition: " << std::endl;
	stream << "type: " << JoinTypeToString(ob.type) << std::endl;
	if (ob.left != NULL) {
		//stream << "left not null" << std::endl;
		stream << "left: " << *(ob.left) << std::endl;
	}
	else stream << "left is null" << std::endl;
	if (ob.right != NULL) {
		//stream << "right not null" << std::endl;
		stream << "right: " << *(ob.right) << std::endl;
	}
	else stream << "right is null" << std::endl;
	if (ob.condition != NULL) {
		stream << "condition: " << *(ob.condition) << std::endl;
	}
	else stream << "condition is null" << std::endl;
	return stream;
}