Created
August 1, 2013 00:37
-
-
Save matthayes/6127545 to your computer and use it in GitHub Desktop.
Example using DataFu's COALESCE to replace a value with zero if it is null.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
define COALESCE datafu.pig.util.Coalesce(); | |
data = LOAD 'input' using PigStorage(',') AS (val:INT); | |
dump data; | |
-- (1) | |
-- () | |
data2 = FOREACH data GENERATE COALESCE(val,0) as result; | |
dump data2; | |
-- (1) | |
-- (0) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment