Is there any Conditional IF like operator in Apache PIG?

后端 未结 5 1038
灰色年华
灰色年华 2020-12-18 20:35

Actually I am writing PIG Script and want to execute some set of statements if one of the condition is satisfied.

I have set one variable and checking for some value

5条回答
  •  一整个雨季
    2020-12-18 21:30

    Create a UDF (say, in Java) and then embed that into your PIG script. You will need to 'register' the jar file that you generate after writing the UDF.

    //(something like this), say your Java UDF class is UDFCondition & the generated jar file is PigUDFCondition.jar, then in your PIG Code

    register PigUDFCondition.jar

    X = foreach A generate UDFCondition(..flag...)
    

提交回复
热议问题