Pig Script no load

I'm new to Pig. I am trying to figure out how to identify a bag or tuple with hard-coded values ​​without loading data from a file. Each example that I come across starts with:

a = LOAD '/ file / name' using PigStorage (',');

or something similar. I just want to create a tuple or bag as follows:

a = <1,2,3>;

Can hardcoded values ​​be used for testing purposes?

Thanks.

+7
hadoop apache-pig
source share
2 answers

As far as I can tell, there is no way to declare hard-coded values ​​with PigLatin itself. If you want to test your scripts, you can use UDF . This will allow you to state what you want in your chosen language.

0
source share

Unfortunately, it is not possible to create a tuple or bag in Pig like this in the current version (0.15.0).

My suggestion is to create a simple text file with multiple values ​​separated by commas and use the following command:

a = LOAD '/path' using PigStorage(','); 

The text file should look something like this:

 1,2,3 

We hope that in future versions they will release some way to create a tuple or bag with a single command.

Good luck practicing the pig!

0
source share

All Articles