protected RowResolver buildRowResolverForWindowing(WindowTableFunctionDef def)
      throws SemanticException {
    RowResolver rr = new RowResolver();
    HashMap<String, WindowExpressionSpec> aliasToExprMap = windowingSpec.getAliasToWdwExpr();

    /*
     * add Window Functions
     */
    for (WindowFunctionDef wFnDef : def.getWindowFunctions()) {
      ASTNode ast = aliasToExprMap.get(wFnDef.getAlias()).getExpression();
      ObjectInspector wFnOI = null;
      if (wFnDef.isPivotResult()) {
        wFnOI = ((ListObjectInspector) wFnDef.getOI()).getListElementObjectInspector();
      }
      else {
        wFnOI = wFnDef.getOI();
      }
      ColumnInfo cInfo = new ColumnInfo(wFnDef.getAlias(),
          TypeInfoUtils.getTypeInfoFromObjectInspector(wFnOI),
          null, true, true);
      rr.putExpression(ast, cInfo);
    }

    RowResolver inpRR = def.getRawInputShape().getRr();
    /*
     * add columns from inpRR
     */
    for (ColumnInfo inpCInfo : inputRR.getColumnInfos()) {
      ColumnInfo cInfo = new ColumnInfo(inpCInfo);

      ASTNode inExpr = PTFTranslator.getASTNode(inpCInfo, inpRR);
      if (inExpr != null) {
        rr.putExpression(inExpr, cInfo);
      } else {
        String[] tabColAlias = inputRR.reverseLookup(inpCInfo.getInternalName());
        if (tabColAlias != null) {
          rr.put(tabColAlias[0], tabColAlias[1], cInfo);
        } else {
          rr.put(inpCInfo.getTabAlias(), inpCInfo.getAlias(), cInfo);
        }
      }
      
      String[] altMapping = inputRR.getAlternateMappings(inpCInfo.getInternalName());
      if ( altMapping != null ) {
        rr.put(altMapping[0], altMapping[1], cInfo);
      }
    }

    return rr;
  }
For each column on the input RR, construct a StructField for it
OI is constructed using the list of input column names and
their corresponding OIs.

@param rr
@return
ql/src/java/org/apache/hadoop/hive/ql/parse/PTFTranslator.java