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

Pig UDF with bag input

Pig UDF with bag input

Explorer

Is it possible to write the a UDF that works as following?

 

B= load ...

A = PigUDF(B)

 

I keep getting the following error "Cannot expand macro 'PigUDF'. Reason: Macro must be defined before expansion." .

 

Thank you

1 REPLY 1
Highlighted

Re: Pig UDF with bag input

Master Guru
What do you intend the UDF to do exactly during the statement: X = UDF(Y)? What is your UDF trying to achieve?

A UDF can process a row or a column, but it needs to be coupled with an actual logical Pig statement to be invoked, such as FOREACH, etc.

Such a syntax does not make much sense in Pig's context.