Biffy
Biffy

Reputation: 871

PIG Latin: Output Path based on Field Value

I have a Logfile which contains logs from multiple domains. Now I want to do some analytics on them and STORE the output in a directory named like the domain. I have the domain as a field value in my logs:

STORE outputlogs INTO 'testpath/DOMAIN/logs USING....

Is this possible? Or can I only store the outputs in a hardcoded filepath?

Upvotes: 1

Views: 93

Answers (1)

mr2ert
mr2ert

Reputation: 5184

If the name of the domain is a field in outputlogs then you can use MultiStorage from piggybank. Something like:

STORE outputlogs INTO 'testpath/DOMAIN/logs' 
                 USING MultiStorage('testpath/DOMAIN/logs','0') ;

Where 0 is the positional field of the domain.

Upvotes: 1

Related Questions