romain-nio
romain-nio

Reputation: 1205

Define tuple datas in the pig script

I am currently debugging a pig script. I'd like to define a tuple in the Pig file directly (instead of the basic "Load" function).

Is there a way to do it?

I am looking for something like that:

A= ('name#bob'','age#29';'name#paul','age#12')

The dump Will return :

('bob',29)
('paul',12)

Upvotes: 14

Views: 2431

Answers (2)

romain-nio
romain-nio

Reputation: 1205

The following (dirty) trick do the job: - create a file With one empty row ans store it to your HDFS. - load it : Line = load /user/toto/onelinefile USING .. - create own datas : foreach line generate 'bob' as name, 22 as age;

Upvotes: 1

Davis Broda
Davis Broda

Reputation: 4137

It is in fact impossibble to do this in pig as it currently stands. If you just want to debug create a file in hadoop and load that. Write the data you want into the file (whatever you would have created manually had it been possibble) and upload it. Then load it using pig.

Upvotes: 4

Related Questions