[Solved-2 Solutions] Define tuple datas in the pig script ?



What is tuple ?

  • A Pig relation is a bag of tuples. A Pig relation is similar to a table in a relational database, where the tuples in the bag correspond to the rows in a table

Problem

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

Is there a way to do it?

Here is the example:

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

The dump Will return :

('wiki',29)
('paul',12)

Solution 1:

  • Its is difficult to do in pig script as it currently stands.If we just want to debug create a file in hadoop and load that.
  • Write the data we want into the file and upload it. Then load it using pig.this is the one way

Solution 2:

The following step can also 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 'wiki' as name, 22 as age;


Related Searches to Define tuple datas in the pig script