private List<String> getColumnAliasesFromASTNode(ASTNode selExprClause,
      RexCall udtfCall) throws SemanticException {
    Set<String> uniqueNames = new HashSet<>();
    List<String> colAliases = new ArrayList<>();
    for (Node obj : selExprClause.getChildren()) {
      ASTNode child = (ASTNode) obj;
      // Skip the token values.  The rest should be the identifier column aliases
      if (child.getToken().getType() == HiveParser.TOK_TABALIAS ||
          child.getToken().getType() == HiveParser.TOK_FUNCTION) {
        continue;
      }
      String colAlias = BaseSemanticAnalyzer.unescapeIdentifier(child.getText().toLowerCase());
      if (uniqueNames.contains(colAlias)) {
        // Column aliases defined by query for lateral view output are duplicated
        throw new SemanticException(ErrorMsg.COLUMN_ALIAS_ALREADY_EXISTS.getMsg(colAlias));
      }
      uniqueNames.add(colAlias);
      colAliases.add(colAlias);
    }

    // if no column aliases were provided, just retrieve them from the return type
    // of the udtf RexCall
    if (colAliases.isEmpty()) {
      colAliases.addAll(
          Lists.transform(udtfCall.getType().getFieldList(), RelDataTypeField::getName));
    }

    // Verify that there is an alias for all the columns returned by the udtf call.
    int udtfFieldCount = udtfCall.getType().getFieldCount();
    if (colAliases.size() != udtfFieldCount) {
      // Number of columns in the aliases does not match with number of columns
      // generated by the lateral view
      throw new SemanticException(ErrorMsg.UDTF_ALIAS_MISMATCH.getMsg(
          "expected " + udtfFieldCount + " aliases but got " + colAliases.size()));
    }

    return colAliases;
  }
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