Skip to content

Instantly share code, notes, and snippets.

@kimsterv
Created March 29, 2011 16:46
Show Gist options
  • Save kimsterv/892718 to your computer and use it in GitHub Desktop.
Save kimsterv/892718 to your computer and use it in GitHub Desktop.
@Override
public void prepareToRead(@SuppressWarnings("rawtypes") RecordReader reader, PigSplit split)
throws IOException {
mSplit = split;
in = reader;
}
//add something like this to your getNext()
if (mSplit != null) {
FileSplit fs = (FileSplit) mSplit.getWrappedSplit();
String fn = fs.getPath().toString();
value = new Text(in.getCurrentValue() + "," + fn);
} else {
value = (Text) in.getCurrentValue();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment