6

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 ?

Chhaya Vishwakarma
  • 1,407
  • 9
  • 44
  • 72

1 Answers1

11

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

kubi
  • 48,104
  • 19
  • 94
  • 118
Debaditya
  • 2,419
  • 1
  • 27
  • 46