private PartitioningSpec getPSpec(RexWindow window) {
    PartitioningSpec partitioning = new PartitioningSpec();

    Schema schema = new Schema(tabAlias, inputRowType.getFieldList());

    if (window.partitionKeys != null && !window.partitionKeys.isEmpty()) {
      PartitionSpec pSpec = new PartitionSpec();
      for (RexNode pk : window.partitionKeys) {
        PartitionExpression exprSpec = new PartitionExpression();
        ASTNode astNode = pk.accept(new RexVisitor(schema));
        exprSpec.setExpression(astNode);
        pSpec.addExpression(exprSpec);
      }
      partitioning.setPartSpec(pSpec);
    }

    if (window.orderKeys != null && !window.orderKeys.isEmpty()) {
      OrderSpec oSpec = new OrderSpec();
      for (RexFieldCollation ok : window.orderKeys) {
        OrderExpression exprSpec = new OrderExpression();
        Order order = ok.getDirection() == RelFieldCollation.Direction.ASCENDING ?
                Order.ASC : Order.DESC;
        NullOrder nullOrder;
        if ( ok.right.contains(SqlKind.NULLS_FIRST) ) {
          nullOrder = NullOrder.NULLS_FIRST;
        } else if ( ok.right.contains(SqlKind.NULLS_LAST) ) {
          nullOrder = NullOrder.NULLS_LAST;
        } else {
          // Default
          nullOrder = ok.getDirection() == RelFieldCollation.Direction.ASCENDING ?
                  NullOrder.NULLS_FIRST : NullOrder.NULLS_LAST;
        }
        exprSpec.setOrder(order);
        exprSpec.setNullOrder(nullOrder);
        ASTNode astNode = ok.left.accept(new RexVisitor(schema));
        exprSpec.setExpression(astNode);
        oSpec.addExpression(exprSpec);
      }
      partitioning.setOrderSpec(oSpec);
    }

    return partitioning;
  }
TODO: Handle 1) cast 2), Windowing Agg Call
ql/src/java/org/apache/hadoop/hive/ql/optimizer/calcite/translator/ExprNodeConverter.java