@InterfaceAudience.Public @InterfaceStability.Stable public interface Tuple extends org.apache.hadoop.io.WritableComparable, Serializable, Iterable<Object>
Tuples are constructed only by a TupleFactory
. A
DefaultTupleFactory
is provided by the system. If users wish to use their own type of
Tuple, they should also provide an implementation of TupleFactory
to
construct their types of Tuples.
Modifier and Type | Field and Description |
---|---|
static byte |
NOTNULL
Marker for indicating whether the value this object holds
is not a null
|
static byte |
NULL
Marker for indicating whether the value this object holds
is a null
|
Modifier and Type | Method and Description |
---|---|
void |
append(Object val)
Append a field to a tuple.
|
Object |
get(int fieldNum)
Get the value in a given field.
|
List<Object> |
getAll()
Get all of the fields in the tuple as a list.
|
long |
getMemorySize()
Determine the size of tuple in memory.
|
byte |
getType(int fieldNum)
Find the type of a given field.
|
boolean |
isNull(int fieldNum)
Find out if a given field is null.
|
void |
reference(Tuple t)
Deprecated.
|
void |
set(int fieldNum,
Object val)
Set the value in a given field.
|
int |
size()
Find the size of the tuple.
|
String |
toDelimitedString(String delim)
Write a tuple of values into a string.
|
compareTo
forEach, iterator, spliterator
static final byte NULL
static final byte NOTNULL
@Deprecated void reference(Tuple t)
t
- Tuple to reference.int size()
boolean isNull(int fieldNum) throws ExecException
fieldNum
- Number of field to check for null.ExecException
- if the field number given is greater
than or equal to the number of fields in the tuple.byte getType(int fieldNum) throws ExecException
fieldNum
- Number of field to get the type for.DataType
. If the field is null, then DataType.UNKNOWN
will be returned.ExecException
- if the field number is greater than or equal to
the number of fields in the tuple.Object get(int fieldNum) throws ExecException
fieldNum
- Number of the field to get the value for.ExecException
- if the field number is greater than or equal to
the number of fields in the tuple.List<Object> getAll()
void set(int fieldNum, Object val) throws ExecException
TupleFactory.newTuple(int)
with an
argument greater than the fieldNum being passed here. This call will
not automatically expand the tuple size. That is if you called
TupleFactory.newTuple(int)
with a 2, it is okay to call
this function with a 1, but not with a 2 or greater.fieldNum
- Number of the field to set the value for.val
- Object to put in the indicated field.ExecException
- if the field number is greater than or equal to
the number of fields in the tuple.void append(Object val)
TupleFactory.newTuple(int)
and then fill in the values with
set(int, Object)
, rather
than construct it with TupleFactory.newTuple()
and append values.val
- Object to append to the tuple.long getMemorySize()
String toDelimitedString(String delim) throws ExecException
delim
- Delimiter to use in the string.ExecException
- this is never thrown. This only exists for backwards compatability reasons.Copyright © 2007-2017 The Apache Software Foundation