cascading.scheme
Class WritableSequenceFile

java.lang.Object
  extended by cascading.scheme.Scheme
      extended by cascading.scheme.SequenceFile
          extended by cascading.scheme.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(TupleEntry tupleEntry, OutputCollector outputCollector)
          Method sink writes out the given Tuple instance to the outputCollector.
 void sinkInit(Tap tap, JobConf conf)
          Method sinkInit initializes this instance as a sink.
 Tuple source(Object key, Object value)
          Method source takes the given Hadoop key and value and returns a new Tuple instance.
 
Methods inherited from class cascading.scheme.SequenceFile
sourceInit
 
Methods inherited from class cascading.scheme.Scheme
getNumSinkParts, getSinkFields, getSourceFields, getTrace, isSink, isSource, isSymmetrical, isWriteDirect, setNumSinkParts, setSinkFields, setSourceFields, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

keyType

protected Class<? extends Writable> keyType

valueType

protected 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

sinkInit

public void sinkInit(Tap tap,
                     JobConf conf)
Description copied from class: Scheme
Method sinkInit initializes this instance as a sink.

Overrides:
sinkInit in class SequenceFile
Parameters:
tap - of type Tap
conf - of type JobConf

source

public Tuple source(Object key,
                    Object value)
Description copied from class: Scheme
Method source takes the given Hadoop key and value and returns a new Tuple instance.

Overrides:
source in class SequenceFile
Parameters:
key - of type WritableComparable
value - of type Writable
Returns:
Tuple

sink

public void sink(TupleEntry tupleEntry,
                 OutputCollector outputCollector)
          throws IOException
Description copied from class: Scheme
Method sink writes out the given Tuple instance to the outputCollector.

Overrides:
sink in class SequenceFile
outputCollector - of type OutputCollector @throws IOException when
Throws:
IOException

equals

public boolean equals(Object object)
Overrides:
equals in class Scheme

hashCode

public int hashCode()
Overrides:
hashCode in class Scheme


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