return wi;
}
Pair<RexNode, TypeInfo> genWindowingProj(QB qb, WindowExpressionSpec wExpSpec, RelNode srcRel)
throws SemanticException {
RexNode w = null;
TypeInfo wHiveRetType = null;
if (wExpSpec instanceof WindowFunctionSpec) {
WindowFunctionSpec wFnSpec = (WindowFunctionSpec) wExpSpec;
ASTNode windowProjAst = wFnSpec.getExpression();
// TODO: do we need to get to child?
int wndSpecASTIndx = getWindowSpecIndx(windowProjAst);
// 2. Get Hive Aggregate Info
AggInfo hiveAggInfo = getHiveAggInfo(windowProjAst, wndSpecASTIndx - 1,
this.relToHiveRR.get(srcRel));
// 3. Get Optiq Return type for Agg Fn
wHiveRetType = hiveAggInfo.m_returnType;
RelDataType optiqAggFnRetType = TypeConverter.convert(hiveAggInfo.m_returnType,
this.cluster.getTypeFactory());
// 4. Convert Agg Fn args to Optiq
ImmutableMap<String, Integer> posMap = this.relToHiveColNameOptiqPosMap.get(srcRel);
RexNodeConverter converter = new RexNodeConverter(this.cluster, srcRel.getRowType(),
posMap, 0, false);
Builder<RexNode> optiqAggFnArgsBldr = ImmutableList.<RexNode> builder();
Builder<RelDataType> optiqAggFnArgsTypeBldr = ImmutableList.<RelDataType> builder();
RexNode rexNd = null;
for (int i = 0; i < hiveAggInfo.m_aggParams.size(); i++) {
optiqAggFnArgsBldr.add(converter.convert(hiveAggInfo.m_aggParams.get(i)));
optiqAggFnArgsTypeBldr.add(TypeConverter.convert(hiveAggInfo.m_aggParams.get(i)
.getTypeInfo(), this.cluster.getTypeFactory()));
}