5
votes

how to declare a variable in PIG? suppose i want to have a integer to have values as 10 how can i declare it in script? and how schema can be reused ?

1

1 Answers

10
votes

I think you can use the 'Declare' command. It is used to describe one parameter and is used within the PIG script.

    %declare DESC 'Database'
    A = load 'data' as (name, desc);
    B = FILTER A by desc eq '$DESC';
    .....

You can get more about it here. Pig Parameter