Expressions and CASE statements
Custom Expression Builder provides built-in Pig functions and UDFs (User-Defined Functions) that transform and join data with powerful and flexible operations. Note that when using a CASE statement, only expressions with non-conditional variables will validate. Due to a limitation in Pig, CASE statements built with conditional operators such as NULL, IS NULL, greater than or equal to (>=) etc., the transformation must be staged in two distinct expressions: The first establishes a condition with a boolean determination (true/false), the second expression determines the run-time field value depending on the whether the condition is true.
The following example demonstrates this sequence. The first transform determines if the field MIN_SALARY is greater than or equal to 4000. The second transform changes the output so that MIN_SALARY values greater than or equal to 4000 will display runtime output Tier A and values less than 4000 will display Tier B.
Note that this two-step operation requires the use of two sequential controls in the dataflow.
First custom expression:
Second custom expression: