org.apache.pig.data
Class AbstractTuple
java.lang.Object
org.apache.pig.data.AbstractTuple
- All Implemented Interfaces:
- Serializable, Comparable, Iterable<Object>, org.apache.hadoop.io.Writable, org.apache.hadoop.io.WritableComparable, Tuple
- Direct Known Subclasses:
- DefaultTuple, ExampleTuple, SchemaTuple, TargetedTuple
public abstract class AbstractTuple
- extends Object
- implements Tuple
This class provides a convenient base for Tuple implementations. This makes it easier
to provide default implementations as the Tuple interface is evolved.
- See Also:
- Serialized Form
Methods inherited from interface org.apache.hadoop.io.Writable |
readFields, write |
AbstractTuple
public AbstractTuple()
iterator
public Iterator<Object> iterator()
- Specified by:
iterator
in interface Iterable<Object>
toString
public String toString()
- Overrides:
toString
in class Object
toDelimitedString
public String toDelimitedString(String delim)
throws ExecException
- Write a tuple of values into a string. The output will be the result
of calling toString on each of the values in the tuple.
- Specified by:
toDelimitedString
in interface Tuple
- Parameters:
delim
- Delimiter to use in the string.
- Returns:
- A string containing the tuple.
- Throws:
ExecException
- this is never thrown. This only exists for backwards compatability reasons.
getType
public byte getType(int fieldNum)
throws ExecException
- Find the type of a given field.
- Specified by:
getType
in interface Tuple
- Parameters:
fieldNum
- Number of field to get the type for.
- Returns:
- type, encoded as a byte value. The values are defined in
DataType
. If the field is null, then DataType.UNKNOWN
will be returned.
- Throws:
ExecException
- if the field number is greater than or equal to
the number of fields in the tuple.
isNull
public boolean isNull(int fieldNum)
throws ExecException
- Find out if a given field is null.
- Specified by:
isNull
in interface Tuple
- Parameters:
fieldNum
- Number of field to check for null.
- Returns:
- true if the field is null, false otherwise.
- Throws:
ExecException
- if the field number given is greater
than or equal to the number of fields in the tuple.
equals
public boolean equals(Object other)
- Overrides:
equals
in class Object
reference
public void reference(Tuple t)
- Description copied from interface:
Tuple
- Make this tuple reference the contents of another. This method does not copy
the underlying data. It maintains references to the data from the original
tuple (and possibly even to the data structure holding the data).
- Specified by:
reference
in interface Tuple
- Parameters:
t
- Tuple to reference.
Copyright © 2007-2012 The Apache Software Foundation