...
Code Block |
---|
public class PigStorageWithInputPath extends PigStorage { Path path = null; @Override public void prepareToRead(RecordReader reader, PigSplit split) { super.prepareToRead(reader, split); path = ((FileSplit)split.getWrappedSplit()).getPath(); } @Override public Tuple getNext() throws IOException { Tuple myTuple = super.getNext(); if (myTuple != null) myTuple.append(path.toString()); return myTuple; } } |
In Pig 0.8/0.9.0 and beyond/0.9.1, you need to set "pig.splitCombination" to false for PigStorageWithInputPath work correctly. 0.9.2 fix the issue.
Q: How can I calculate a percentage (partial aggregate / total aggregate)?
...