private RowResolver getOutputRR(RowResolver inputRR, RexCall udtfCall,
      List<String> columnAliases, String lateralTableAlias) throws SemanticException {

    RowResolver localOutputRR = new RowResolver();

    // After calling RowResolver, outputRR will be mutated to contain the row resolver
    // fields
    if (!RowResolver.add(localOutputRR, inputRR)) {
      LOG.warn("Duplicates detected when adding columns to RR: see previous message");
    }

    // The RexNode return value for a udtf is always a struct.
    TypeInfo typeInfo = TypeConverter.convert(udtfCall.getType());
    Preconditions.checkState(typeInfo instanceof StructTypeInfo);

    StructTypeInfo typeInfos = (StructTypeInfo) typeInfo;
    // Match up the column alias with the return value of the udtf and
    // place in the outputRR
    for (int i = 0, j = 0; i < columnAliases.size(); i++) {
      String internalColName;
      do {
        internalColName = SemanticAnalyzer.getColumnInternalName(j++);
      } while (localOutputRR.getPosition(internalColName) != -1);
      localOutputRR.put(lateralTableAlias, columnAliases.get(i),
          new ColumnInfo(internalColName,  typeInfos.getAllStructFieldTypeInfos().get(i),
              lateralTableAlias, false));
    }
    return localOutputRR;
  }
LateralViewPlan is a helper class holding the objects needed for generating a Calcite
plan from an ASTNode. The object is to be generated when a LATERAL_VIEW token is detected.
From the ASTNode and relevant input node information, the following objects are created:
* A HiveTableFunctionScan RelNode
* A RowResolver containing the row resolving information output from the RelNode
* The table alias for the table generated by the UDTF and Lateral View
ql/src/java/org/apache/hadoop/hive/ql/parse/relnodegen/LateralViewPlan.java