boolean r = caseOIResolver.update(arguments[0]);
assert(r);
for (int i=1; i+1<arguments.length; i+=2) {
if (!caseOIResolver.update(arguments[i])) {
throw new UDFArgumentTypeException(i,
"The expressions after WHEN should have the same type with that after CASE: \""
+ caseOIResolver.get().getTypeName() + "\" is expected but \""
+ arguments[i].getTypeName() + "\" is found");
}
if (!returnOIResolver.update(arguments[i+1])) {
throw new UDFArgumentTypeException(i+1,
"The expressions after THEN should have the same type: \""
+ returnOIResolver.get().getTypeName() + "\" is expected but \""
+ arguments[i+1].getTypeName() + "\" is found");
}
}
if (arguments.length % 2 == 0) {
int i = arguments.length - 2;
if (!returnOIResolver.update(arguments[i+1])) {
throw new UDFArgumentTypeException(i+1,
"The expression after ELSE should have the same type as those after THEN: \""
+ returnOIResolver.get().getTypeName() + "\" is expected but \""
+ arguments[i+1].getTypeName() + "\" is found");
}
}