I am trying to load a json file with pig. I can load the file succesfully, but i found a bug.
schema:
id,name,brand,color
data:
{"id":2561,"name":"abc","brand":"Levis","color":"Blue"}
{"id":2562,"brand":"Adidas","color":"Black"}
{"id":2563,"name":"edf","brand":"Nike","color":"White"}
code:
raw = LOAD '$INPUT_PATH' USING JsonLoader('
id:chararray,
name:chararray,
brand:chararray,
color:chararray
');
x = foreach raw generate id,brand;
dump x;
And result is wrong if the particular raw does no contains all the fields defined in the schema: (the second raw should be Adidas instead of black)
(2561,Levis)
(2562,Black)
(2563,Nike)
Is there any workaround for the above?
thanks in advance