Exemplo n.º 1
0
/**
 * 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;
}
/**
 * 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() {
  assert(join_type_ != JOIN_TYPE_INVALID);

  switch (join_type_) {
    case JOIN_TYPE_LEFT: {
      return BuildLeftJoinOutput();
    }

    case JOIN_TYPE_RIGHT: {
      return BuildRightJoinOutput();
    }

    case JOIN_TYPE_OUTER: {
      bool status = BuildLeftJoinOutput();

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

    case JOIN_TYPE_INNER: {
      return false;
    }

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

  return false;
}