public List<FieldNode> getSelectColsFromChildren(SelectOperator op,
      List<FieldNode> colList) {
    List<FieldNode> cols = new ArrayList<>();
    SelectDesc conf = op.getConf();

    if (colList != null  && conf.isSelStarNoCompute()) {
      cols.addAll(colList);
      return cols;
    }

    List<ExprNodeDesc> selectExprs = conf.getColList();

    // The colList is the output columns used by child operators, they are
    // different
    // from input columns of the current operator. we need to find out which
    // input columns are used.
    List<String> outputColumnNames = conf.getOutputColumnNames();
    for (int i = 0; i < outputColumnNames.size(); i++) {
      if (colList == null) {
        cols = mergeFieldNodesWithDesc(cols, selectExprs.get(i));
      } else {
        FieldNode childFn = lookupColumn(colList, outputColumnNames.get(i));
        if (childFn != null) {
          // In SemanticAnalyzer we inject SEL op before aggregation. The columns
          // in this SEL are derived from the table schema, and do not reflect the
          // actual columns being selected in the current query.
          // In this case, we skip the merge and just use the path from the child ops.
          ExprNodeDesc desc = selectExprs.get(i);
          if (desc instanceof ExprNodeColumnDesc && ((ExprNodeColumnDesc) desc).getIsGenerated()) {
            FieldNode fn = new FieldNode(((ExprNodeColumnDesc) desc).getColumn());
            fn.setNodes(childFn.getNodes());
            cols = mergeFieldNodes(cols, fn);
          } else {
            cols = mergeFieldNodesWithDesc(cols, selectExprs.get(i));
          }
        }
      }
    }

    return cols;
  }
Creates the list of internal column names for select * expressions.

@param op The select operator.
@param colList The list of internal column names (represented by field nodes)
               returned by the children of the select operator.
@return a list of field nodes representing the internal column names.
ql/src/java/org/apache/hadoop/hive/ql/optimizer/ColumnPrunerProcCtx.java