/** * If the genericUDF is a base comparison, it returns an integer based on the result of comparing * the two sides of the UDF, like the compareTo method in Comparable. * * If the genericUDF is not a base comparison, or there is an error executing the comparison, it * returns null. * @param row * @return the compare results * @throws HiveException */ public Integer compare(Object row) throws HiveException { if (!expr.isSortedExpr() || !(genericUDF instanceof GenericUDFBaseCompare)) { for (ExprNodeEvaluator evaluator: children) { if (evaluator instanceof ExprNodeGenericFuncEvaluator) { Integer comparison = ((ExprNodeGenericFuncEvaluator) evaluator).compare(row); if (comparison != null) { return comparison; } } } return null; } rowObject = row; for (int i = 0; i < deferredChildren.length; i++) { deferredChildren[i].prepare(-1); } return ((GenericUDFBaseCompare)genericUDF).compare(deferredChildren); } }
/** * If the genericUDF is a base comparison, it returns an integer based on the result of comparing * the two sides of the UDF, like the compareTo method in Comparable. * * If the genericUDF is not a base comparison, or there is an error executing the comparison, it * returns null. * @param row * @return the compare results * @throws HiveException */ public Integer compare(Object row) throws HiveException { if (!expr.isSortedExpr() || !(genericUDF instanceof GenericUDFBaseCompare)) { for (ExprNodeEvaluator evaluator: children) { if (evaluator instanceof ExprNodeGenericFuncEvaluator) { Integer comparison = ((ExprNodeGenericFuncEvaluator) evaluator).compare(row); if (comparison != null) { return comparison; } } } return null; } rowObject = row; for (int i = 0; i < deferredChildren.length; i++) { deferredChildren[i].prepare(-1); } return ((GenericUDFBaseCompare)genericUDF).compare(deferredChildren); } }
/** * If the genericUDF is a base comparison, it returns an integer based on the result of comparing * the two sides of the UDF, like the compareTo method in Comparable. * * If the genericUDF is not a base comparison, or there is an error executing the comparison, it * returns null. * @param row * @return the compare results * @throws HiveException */ public Integer compare(Object row) throws HiveException { if (!expr.isSortedExpr() || !(genericUDF instanceof GenericUDFBaseCompare)) { for (ExprNodeEvaluator evaluator: children) { if (evaluator instanceof ExprNodeGenericFuncEvaluator) { Integer comparison = ((ExprNodeGenericFuncEvaluator) evaluator).compare(row); if (comparison != null) { return comparison; } } } return null; } rowObject = row; for (int i = 0; i < deferredChildren.length; i++) { deferredChildren[i].prepare(-1); } return ((GenericUDFBaseCompare)genericUDF).compare(deferredChildren); } }