List<Pair<ASTNode, TypeInfo>> vcASTTypePairs = new ArrayList<Pair<ASTNode, TypeInfo>>();
RowResolver inputRR = relToHiveRR.get(srcRel);
RowResolver outputRR = new RowResolver();
RexNode rnd;
RexNodeConverter converter = new RexNodeConverter(cluster, srcRel.getRowType(),
relToHiveColNameOptiqPosMap.get(srcRel), 0, false);
int srcRelRecordSz = srcRel.getRowType().getFieldCount();
for (int i = 0; i < obASTExprLst.size(); i++) {
// 2.1 Convert AST Expr to ExprNode
obASTExpr = (ASTNode) obASTExprLst.get(i);
Map<ASTNode, ExprNodeDesc> astToExprNDescMap = TypeCheckProcFactory.genExprNode(
obASTExpr, new TypeCheckCtx(inputRR));
ExprNodeDesc obExprNDesc = astToExprNDescMap.get(obASTExpr.getChild(0));
if (obExprNDesc == null)
throw new SemanticException("Invalid order by expression: " + obASTExpr.toString());
// 2.2 Convert ExprNode to RexNode
rnd = converter.convert(obExprNDesc);
// 2.3 Determine the index of ob expr in child schema
// NOTE: Optiq can not take compound exprs in OB without it being
// present in the child (& hence we add a child Project Rel)
if (rnd instanceof RexInputRef) {