private long evaluateExpression(Statistics stats, ExprNodeDesc pred,
AnnotateStatsProcCtx aspCtx, List<String> neededCols) throws CloneNotSupportedException {
long newNumRows = 0;
Statistics andStats = null;
if (pred instanceof ExprNodeGenericFuncDesc) {
ExprNodeGenericFuncDesc genFunc = (ExprNodeGenericFuncDesc) pred;
GenericUDF udf = genFunc.getGenericUDF();
// for AND condition cascadingly update stats
if (udf instanceof GenericUDFOPAnd) {
andStats = stats.clone();
aspCtx.setAndExprStats(andStats);
// evaluate children
for (ExprNodeDesc child : genFunc.getChildren()) {
newNumRows = evaluateChildExpr(aspCtx.getAndExprStats(), child, aspCtx, neededCols);
if (satisfyPrecondition(aspCtx.getAndExprStats())) {
updateStats(aspCtx.getAndExprStats(), newNumRows, true);
} else {
updateStats(aspCtx.getAndExprStats(), newNumRows, false);
}
}
} else if (udf instanceof GenericUDFOPOr) {
// for OR condition independently compute and update stats
for (ExprNodeDesc child : genFunc.getChildren()) {
newNumRows += evaluateChildExpr(stats, child, aspCtx, neededCols);
}
} else if (udf instanceof GenericUDFOPNot) {
newNumRows = evaluateNotExpr(stats, pred, aspCtx, neededCols);
} else {