use of com.sap.hadoop.windowing.query2.translate.QueryTranslationInfo in project SQLWindowing by hbutani.
the class WhereTranslation method translate.
public static void translate(QueryDef qDef) throws WindowingException {
QueryTranslationInfo tInfo = qDef.getTranslationInfo();
QuerySpec spec = qDef.getSpec();
ASTNode wExpr = spec.getWhereExpr();
if (wExpr == null)
return;
WhereDef whDef = new WhereDef();
whDef.setExpression(wExpr);
QueryInputDef iDef = qDef.getInput();
InputInfo iInfo = tInfo.getInputInfo(iDef);
ExprNodeDesc exprNode = TranslateUtils.buildExprNode(wExpr, iInfo.getTypeCheckCtx());
ExprNodeEvaluator exprEval = WindowingExprNodeEvaluatorFactory.get(tInfo, exprNode);
ObjectInspector oi = TranslateUtils.initExprNodeEvaluator(qDef, exprNode, exprEval, iInfo);
try {
ObjectInspectorConverters.getConverter(oi, PrimitiveObjectInspectorFactory.javaBooleanObjectInspector);
} catch (Throwable t) {
throw new WindowingException("Where Expr must be convertible to a boolean value", t);
}
whDef.setExprNode(exprNode);
whDef.setExprEvaluator(exprEval);
whDef.setOI(oi);
qDef.setWhere(whDef);
}
Aggregations