cascading.scheme.hadoop
Class WritableSequenceFile

java.lang.Object
  extended by cascading.scheme.Scheme<JobConf,RecordReader,OutputCollector,Object[],Void>
      extended by cascading.scheme.hadoop.SequenceFile
          extended by cascading.scheme.hadoop.WritableSequenceFile
All Implemented Interfaces:
Serializable

public class WritableSequenceFile
extends SequenceFile

Class WritableSequenceFile is a sub-class of SequenceFile that reads and writes values of the given writableType Class, instead of Tuple instances used by default in SequenceFile.

This Class is a convenience for those who need to read/write specific types from existing sequence files without them being wrapped in a Tuple instance.

Note due to the nature of sequence files, only one type can be stored in the key and value positions, they they can be uniquely different types (LongWritable, Text).

If keyType is null, valueType must not be null, and vice versa, assuming you only wish to store a single value.

NullWritable is used as the empty type for either a null keyType or valueType.

See Also:
Serialized Form

Field Summary
protected  Class<? extends Writable> keyType
           
protected  Class<? extends Writable> valueType
           
 
Constructor Summary
WritableSequenceFile(Fields fields, Class<? extends Writable> valueType)
          Constructor WritableSequenceFile creates a new WritableSequenceFile instance.
WritableSequenceFile(Fields fields, Class<? extends Writable> keyType, Class<? extends Writable> valueType)
          Constructor WritableSequenceFile creates a new WritableSequenceFile instance.
 
Method Summary
 boolean equals(Object object)
           
 int hashCode()
           
 void sink(FlowProcess<JobConf> flowProcess, SinkCall<Void,OutputCollector> sinkCall)
           
 void sinkConfInit(FlowProcess<JobConf> flowProcess, Tap<JobConf,RecordReader,OutputCollector> tap, JobConf conf)
           
 boolean source(FlowProcess<JobConf> flowProcess, SourceCall<Object[],RecordReader> sourceCall)
           
 
Methods inherited from class cascading.scheme.hadoop.SequenceFile
sourceCleanup, sourceConfInit, sourcePrepare
 
Methods inherited from class cascading.scheme.Scheme
getNumSinkParts, getSinkFields, getSourceFields, getTrace, isSink, isSource, isSymmetrical, presentSinkFields, presentSinkFieldsInternal, presentSourceFields, presentSourceFieldsInternal, retrieveSinkFields, retrieveSourceFields, setNumSinkParts, setSinkFields, setSourceFields, sinkCleanup, sinkPrepare, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

keyType

protected final Class<? extends Writable> keyType

valueType

protected final Class<? extends Writable> valueType
Constructor Detail

WritableSequenceFile

@ConstructorProperties(value={"fields","valueType"})
public WritableSequenceFile(Fields fields,
                                                       Class<? extends Writable> valueType)
Constructor WritableSequenceFile creates a new WritableSequenceFile instance.

Parameters:
fields - of type Fields
valueType - of type Class, may not be null

WritableSequenceFile

@ConstructorProperties(value={"fields","keyType","valueType"})
public WritableSequenceFile(Fields fields,
                                                       Class<? extends Writable> keyType,
                                                       Class<? extends Writable> valueType)
Constructor WritableSequenceFile creates a new WritableSequenceFile instance.

Parameters:
fields - of type Fields
keyType - of type Class
valueType - of type Class
Method Detail

sinkConfInit

public void sinkConfInit(FlowProcess<JobConf> flowProcess,
                         Tap<JobConf,RecordReader,OutputCollector> tap,
                         JobConf conf)
Overrides:
sinkConfInit in class SequenceFile

source

public boolean source(FlowProcess<JobConf> flowProcess,
                      SourceCall<Object[],RecordReader> sourceCall)
               throws IOException
Overrides:
source in class SequenceFile
Throws:
IOException

sink

public void sink(FlowProcess<JobConf> flowProcess,
                 SinkCall<Void,OutputCollector> sinkCall)
          throws IOException
Overrides:
sink in class SequenceFile
Throws:
IOException

equals

public boolean equals(Object object)
Overrides:
equals in class Scheme<JobConf,RecordReader,OutputCollector,Object[],Void>

hashCode

public int hashCode()
Overrides:
hashCode in class Scheme<JobConf,RecordReader,OutputCollector,Object[],Void>


Copyright © 2007-2013 Concurrent, Inc. All Rights Reserved.