mercredi 22 février 2017

If else condition in Pig to name output file

I am using pig to parse a file, I want to apply if-else condition to check if a statement is present or not. If the statemnet is not there i make the output file name as No otherwise i keep the output file name as it is of the statement. How can i do that.

Example:

amit|COD|12543|nagpur|MH|India

Now i want to check if my $1 is empty or not if it is empty i want to make my output file name to be N.txt or COD.txt.

I checked and found that pig has conditional operator but no If-else can anyone please suggest some work around over here.

Aucun commentaire:

Enregistrer un commentaire