private int getOutputSizeInternal(Operator<? extends OperatorDesc> operator,
      Set<String> bigTables) {

    // If a join operator contains a big subtree, there is a chance that its
    // output is also big, so the output size is 1 (medium)
    if (operator instanceof JoinOperator) {
      for (Operator<? extends OperatorDesc> o : operator.getParentOperators()) {
        if (getOutputSize(o, bigTables) != 0) {
          return 1;
        }
      }
    }

    // If a table is in bigTables then its output is big (2)
    if (operator instanceof TableScanOperator) {
      String alias = ((TableScanOperator) operator).getConf().getAlias();
      if (bigTables.contains(alias)) {
        return 2;
      }
    }

    // For all other kinds of operators, assume the output is as big as the
    // the biggest output from a parent
    int maxSize = 0;
    if (operator.getParentOperators() != null) {
      for (Operator<? extends OperatorDesc> o : operator.getParentOperators()) {
        // recurse into memoized decorator
        int current = getOutputSize(o, bigTables);
        if (current > maxSize) {
          maxSize = current;
        }
      }
    }

    return maxSize;
  }
Estimate the size of the output based on the STREAMTABLE hints. To do so
the whole tree is traversed. Possible sizes: 0: the operator and its
subtree don't contain any big tables 1: the subtree of the operator
contains a big table 2: the operator is a big table

@param operator
         The operator which output size is to be estimated
@param bigTables
         Set of tables that should be streamed
@return The estimated size - 0 (no streamed tables), 1 (streamed tables in
        subtree) or 2 (a streamed table)
ql/src/java/org/apache/hadoop/hive/ql/optimizer/JoinReorder.java