Skip to content

Instantly share code, notes, and snippets.

@cwensel
Created October 5, 2010 17:43
Show Gist options
  • Select an option

  • Save cwensel/611981 to your computer and use it in GitHub Desktop.

Select an option

Save cwensel/611981 to your computer and use it in GitHub Desktop.
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