Created
October 5, 2010 17:43
-
-
Save cwensel/611981 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public class WritableSequenceFile extends SequenceFile | |
| { | |
| protected Class<? extends Writable> writableType; | |
| public WritableSequenceFile( Class<? extends Writable> writableType, Fields fields ) | |
| { | |
| super( fields ); | |
| this.writableType = writableType; | |
| } | |
| @Override | |
| public void sinkInit( Tap tap, JobConf conf ) | |
| { | |
| super.sinkInit( tap, conf ); | |
| conf.setOutputValueClass( writableType ); | |
| } | |
| @Override | |
| public Tuple source( Object key, Object value ) | |
| { | |
| return new Tuple( value ); | |
| } | |
| @Override | |
| public void sink( TupleEntry tupleEntry, OutputCollector outputCollector ) throws IOException | |
| { | |
| outputCollector.collect( Tuples.NULL, tupleEntry.getObject( getSinkFields() ) ); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment