Support Questions
Find answers, ask questions, and share your expertise

When multi valued map field is passed to pig udf its coming as null in udf side.

New Contributor

Data : 123456A89,[datatype#int,length#10]

PIG Script:

REGISTER /u/******/UDF_Jars/pigUdf.jar;

DEFINE validateInput mypackage.PigUDF;

std = LOAD '/user/******/input1.csv' USING PigStorage(',') AS (name:chararray,val:map[]); std_exception = FOREACH std GENERATE validateInput(name,val);

STORE std_exception into 'results3';

UDF exec declaration:

public class PigUDF extends EvalFunc<DataBag>



public DataBag exec(Tuple tuple) throws IOException


// TODO Auto-generated method stub

Map<String,Object> v = (Map<String,Object>)tuple.get(1);

here v is populating as null instead of {datatype=int,length=10}

it works for single key-value pair.