Class TupleWritable
java.lang.Object
org.apache.hadoop.mapreduce.lib.join.TupleWritable
- Direct Known Subclasses:
TupleWritable
Writable type storing multiple
Writables.
This is *not* a general-purpose tuple type. In almost all cases, users are
encouraged to implement their own serializable types, which can perform
better validation and provide more efficient encodings than this class is
capable. TupleWritable relies on the join framework for type safety and
assumes its instances will rarely be persisted, assumptions not only
incompatible with, but contrary to the general case.- See Also:
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionCreate an empty tuple with no allocated storage for writables.TupleWritable(Writable[] vals) Initialize tuple with storage; unknown whether any of them contain "written" values. -
Method Summary
Modifier and TypeMethodDescriptionbooleanget(int i) Get ith Writable from Tuple.booleanhas(int i) Return true if tuple has an element at the position provided.inthashCode()iterator()Return an iterator over the elements in this tuple.voidreadFields(DataInput in) Deserialize the fields of this object fromin.intsize()The number of children in this Tuple.toString()Convert Tuple to String as in the following.voidwrite(DataOutput out) Writes each Writable toout.Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface java.lang.Iterable
forEach, spliterator
-
Field Details
-
written
-
-
Constructor Details
-
TupleWritable
public TupleWritable()Create an empty tuple with no allocated storage for writables. -
TupleWritable
Initialize tuple with storage; unknown whether any of them contain "written" values.
-
-
Method Details
-
has
public boolean has(int i) Return true if tuple has an element at the position provided. -
get
Get ith Writable from Tuple. -
size
public int size()The number of children in this Tuple. -
equals
-
hashCode
public int hashCode() -
iterator
Return an iterator over the elements in this tuple. Note that this doesn't flatten the tuple; one may receive tuples from this iterator. -
toString
Convert Tuple to String as in the following.[<child1>,<child2>,...,<childn>] -
write
Writes each Writable toout. TupleWritable format:<count><type1><type2>...<typen><obj1><obj2>...<objn>- Specified by:
writein interfaceWritable- Parameters:
out-DataOuputto serialize this object into.- Throws:
IOException- any other problem for write.
-
readFields
Deserialize the fields of this object fromin.For efficiency, implementations should attempt to re-use storage in the existing object where possible.
- Specified by:
readFieldsin interfaceWritable- Parameters:
in-DataInputto deseriablize this object from.- Throws:
IOException- any other problem for readFields.
-