I have just started using Pig to analyze a bunch of log files using Hadoop, and I need to load different files depending on the output of a previous calculation. For example, if the output of the calculation is 0x18e0, I need to load a file called 0x18e0.txt. How do I give parameterized file names in the LOAD statement?
In python, it's really straightforward to do this:
x = str(var)
File = open( x + '.txt', 'r')
Is there a similarly simple way to do this in Pig? I cannot give the input in command line like
pig -param input=
x.txt
because I don't know the value of x before I run the script.
I see another option of specifying an input file itself as the parameter as described here https://wiki.apache.org/pig/ParameterSubstitution but this seems unduly roundabout. Is there another solution for this?