use of org.apache.hadoop.hive.ql.exec.ExprNodeEvaluator in project hive by apache.
the class PTFDeserializer method initialize.
protected void initialize(PTFExpressionDef eDef, ShapeDetails inpShape) throws HiveException {
ExprNodeDesc exprNode = eDef.getExprNode();
ExprNodeEvaluator exprEval = WindowingExprNodeEvaluatorFactory.get(llInfo, exprNode);
ObjectInspector oi = initExprNodeEvaluator(exprEval, exprNode, inpShape);
eDef.setExprEvaluator(exprEval);
eDef.setOI(oi);
}
use of org.apache.hadoop.hive.ql.exec.ExprNodeEvaluator 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);
}
use of org.apache.hadoop.hive.ql.exec.ExprNodeEvaluator in project SQLWindowing by hbutani.
the class WindowSpecTranslation method translateColumn.
static void translateColumn(QueryDef qDef, ColumnDef cDef, InputInfo iInfo, ColumnSpec cSpec) throws WindowingException {
String colTabName = cSpec.getTableName();
if (colTabName != null && !colTabName.equals(iInfo.getAlias())) {
throw new WindowingException(sprintf("Unknown Table Reference in column", cSpec));
}
ASTNode expr = TranslateUtils.buildASTNode(cSpec.getColumnName());
ExprNodeDesc exprNode = TranslateUtils.buildExprNode(expr, iInfo.getTypeCheckCtx());
ExprNodeEvaluator exprEval = WindowingExprNodeEvaluatorFactory.get(qDef.getTranslationInfo(), exprNode);
ObjectInspector oi = TranslateUtils.initExprNodeEvaluator(qDef, exprNode, exprEval, iInfo);
cDef.setExpression(expr);
cDef.setExprNode(exprNode);
cDef.setExprEvaluator(exprEval);
cDef.setOI(oi);
cDef.setAlias(cSpec.getColumnName());
}
use of org.apache.hadoop.hive.ql.exec.ExprNodeEvaluator in project SQLWindowing by hbutani.
the class QueryDefDeserializer method visit.
/*
* Recreate the ExprEvaluator, OI using the current inputInfo This is the
* inputInfo on the first InputDef in chain if the query does not have a map
* phase; else it is the mapInputInfo on the table function definition
*/
@Override
public void visit(ArgDef arg) throws WindowingException {
ExprNodeDesc exprNodeDesc = arg.getExprNode();
ExprNodeEvaluator exprEval = WindowingExprNodeEvaluatorFactory.get(tInfo, exprNodeDesc);
ObjectInspector oi = TranslateUtils.initExprNodeEvaluator(qDef, exprNodeDesc, exprEval, inputInfo);
arg.setExprEvaluator(exprEval);
arg.setOI(oi);
}
use of org.apache.hadoop.hive.ql.exec.ExprNodeEvaluator in project SQLWindowing by hbutani.
the class QueryDefDeserializer method visit.
/*
* Recreate ExprNodeEvaluator, OI using InputInfo of first InputDef in
* chain.
*/
@Override
public void visit(ColumnDef column) throws WindowingException {
ExprNodeEvaluator exprEval = WindowingExprNodeEvaluatorFactory.get(tInfo, column.getExprNode());
ObjectInspector oi = TranslateUtils.initExprNodeEvaluator(qDef, column.getExprNode(), exprEval, inputInfo);
column.setExprEvaluator(exprEval);
column.setOI(oi);
}
Aggregations