org.apache.pig.impl.io
Class NullablePartitionWritable

java.lang.Object
  extended by org.apache.pig.impl.io.PigNullableWritable
      extended by org.apache.pig.impl.io.NullablePartitionWritable
All Implemented Interfaces:
Comparable, org.apache.hadoop.io.Writable, org.apache.hadoop.io.WritableComparable

public class NullablePartitionWritable
extends PigNullableWritable

NullablePartitionWritable is an adaptor class around PigNullableWritable that adds a partition index to the class.


Field Summary
 
Fields inherited from class org.apache.pig.impl.io.PigNullableWritable
idxSpace, mqFlag, mValue
 
Constructor Summary
NullablePartitionWritable()
           
NullablePartitionWritable(PigNullableWritable k)
           
 
Method Summary
 int compareTo(Object o)
          Compare two nullable objects.
 byte getIndex()
           
 PigNullableWritable getKey()
           
 int getPartition()
           
 Object getValueAsPigType()
           
 int hashCode()
           
 boolean isNull()
           
 void readFields(DataInput in)
           
 void setIndex(byte index)
           
 void setKey(PigNullableWritable k)
           
 void setNull(boolean isNull)
           
 void setPartition(int n)
           
 String toString()
           
 void write(DataOutput out)
           
 
Methods inherited from class org.apache.pig.impl.io.PigNullableWritable
equals
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

NullablePartitionWritable

public NullablePartitionWritable()

NullablePartitionWritable

public NullablePartitionWritable(PigNullableWritable k)
Method Detail

setKey

public void setKey(PigNullableWritable k)

getKey

public PigNullableWritable getKey()

setPartition

public void setPartition(int n)

getPartition

public int getPartition()

compareTo

public int compareTo(Object o)
Description copied from class: PigNullableWritable
Compare two nullable objects. Step one is to check if either or both are null. If one is null and the other is not, then the one that is null is declared to be less. If both are null the indices are compared. If neither are null the indices are again compared. If these are equal, finally the values are compared. These comparators are used by hadoop as part of the post-map sort, when the data is still in object format.

Specified by:
compareTo in interface Comparable
Overrides:
compareTo in class PigNullableWritable

readFields

public void readFields(DataInput in)
                throws IOException
Specified by:
readFields in interface org.apache.hadoop.io.Writable
Overrides:
readFields in class PigNullableWritable
Throws:
IOException

write

public void write(DataOutput out)
           throws IOException
Specified by:
write in interface org.apache.hadoop.io.Writable
Overrides:
write in class PigNullableWritable
Throws:
IOException

isNull

public boolean isNull()
Overrides:
isNull in class PigNullableWritable
Returns:
the isNull

setNull

public void setNull(boolean isNull)
Overrides:
setNull in class PigNullableWritable
Parameters:
isNull - the isNull to set

getIndex

public byte getIndex()
Overrides:
getIndex in class PigNullableWritable
Returns:
the index for this value

setIndex

public void setIndex(byte index)
Overrides:
setIndex in class PigNullableWritable
Parameters:
index - for this value.

getValueAsPigType

public Object getValueAsPigType()
Specified by:
getValueAsPigType in class PigNullableWritable
Returns:
The wrapped value as a pig type, not as a WritableComparable.

hashCode

public int hashCode()
Overrides:
hashCode in class PigNullableWritable

toString

public String toString()
Overrides:
toString in class PigNullableWritable


Copyright © 2007-2012 The Apache Software Foundation