public class AssertUDF extends org.apache.pig.FilterFunc
Unfortunately, the Pig interpreter doesn't recognize boolean expressions nested as function arguments, so this uses C-style booleans. That is, the first argument should be an integer. 0 is interpreted as "false", and anything else is considered "true". The function will cause the Pig script to fail if a "false" value is encountered.
There is a unary and a binary version. The unary version just takes a boolean, and throws out a generic exception message when the assertion is violated. The binary version takes a String as a second argument and throws that out when the assertion is violated.Example:
FILTER members BY AssertUDF( (member_id >= 0 ? 1 : 0), 'Doh! Some member ID is negative.' );
|Constructor and Description|
|Modifier and Type||Method and Description|
allowCompileTimeCalculation, getArgToFuncMapping, getCacheFiles, getInputSchema, getLogger, getPigLogger, getReporter, getReturnType, getSchemaName, getSchemaType, getShipFiles, isAsynchronous, outputSchema, progress, setInputSchema, setPigLogger, setReporter, setUDFContextSignature, warn