use of com.sap.hadoop.windowing.query2.definition.WindowFrameDef.CurrentRowDef in project SQLWindowing by hbutani.
the class WindowSpecTranslation method translateBoundary.
static BoundaryDef translateBoundary(QueryDef qDef, BoundarySpec bndSpec, InputInfo iInfo) throws WindowingException {
if (bndSpec instanceof ValueBoundarySpec) {
ValueBoundarySpec vBndSpec = (ValueBoundarySpec) bndSpec;
ValueBoundaryDef vbDef = new ValueBoundaryDef(vBndSpec);
TranslateUtils.validateNoLeadLagInValueBoundarySpec(vBndSpec.getExpression());
ExprNodeDesc exprNode = TranslateUtils.buildExprNode(vBndSpec.getExpression(), iInfo.getTypeCheckCtx());
vbDef.setExprNode(exprNode);
ExprNodeEvaluator exprEval = WindowingExprNodeEvaluatorFactory.get(qDef.getTranslationInfo(), exprNode);
ObjectInspector OI = TranslateUtils.initExprNodeEvaluator(qDef, exprNode, exprEval, iInfo);
TranslateUtils.validateValueBoundaryExprType(OI);
vbDef.setExprEvaluator(exprEval);
vbDef.setOI(OI);
return vbDef;
} else if (bndSpec instanceof RangeBoundarySpec) {
RangeBoundarySpec rBndSpec = (RangeBoundarySpec) bndSpec;
RangeBoundaryDef rbDef = new RangeBoundaryDef(rBndSpec);
return rbDef;
} else if (bndSpec instanceof CurrentRowSpec) {
CurrentRowSpec cBndSpec = (CurrentRowSpec) bndSpec;
CurrentRowDef cbDef = new CurrentRowDef(cBndSpec);
return cbDef;
}
throw new WindowingException("Unknown Boundary: " + bndSpec);
}
Aggregations