org.apache.pig.data
Class TargetedTuple

java.lang.Object
  extended by org.apache.pig.data.AbstractTuple
      extended by org.apache.pig.data.TargetedTuple
All Implemented Interfaces:
Serializable, Comparable, Iterable<Object>, org.apache.hadoop.io.Writable, org.apache.hadoop.io.WritableComparable, Tuple

public class TargetedTuple
extends AbstractTuple

A tuple composed with the operators to which it needs be attached

See Also:
Serialized Form

Field Summary
protected  boolean isNull
           
 List<OperatorKey> targetOps
           
 
Fields inherited from interface org.apache.pig.data.Tuple
NOTNULL, NULL
 
Constructor Summary
TargetedTuple()
           
TargetedTuple(Tuple t, List<OperatorKey> targetOps)
           
 
Method Summary
 void append(Object val)
          Append a field to a tuple.
 int compareTo(Object o)
           
 boolean equals(Object o)
           
 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.
 List<OperatorKey> getTargetOps()
           
 byte getType(int fieldNum)
          Find the type of a given field.
 int hashCode()
           
 void readFields(DataInput in)
           
 void reference(Tuple t)
          Make this tuple reference the contents of another.
 void set(int fieldNum, Object val)
          Set the value in a given field.
 void setTargetOps(List<OperatorKey> targetOps)
           
 int size()
          Find the size of the tuple.
 String toString()
           
 Tuple toTuple()
           
 void write(DataOutput out)
           
 
Methods inherited from class org.apache.pig.data.AbstractTuple
isNull, iterator, toDelimitedString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

targetOps

public List<OperatorKey> targetOps

isNull

protected boolean isNull
Constructor Detail

TargetedTuple

public TargetedTuple()

TargetedTuple

public TargetedTuple(Tuple t,
                     List<OperatorKey> targetOps)
Method Detail

toString

public String toString()
Overrides:
toString in class AbstractTuple

write

public void write(DataOutput out)
           throws IOException
Throws:
IOException

readFields

public void readFields(DataInput in)
                throws IOException
Throws:
IOException

toTuple

public Tuple toTuple()

getTargetOps

public List<OperatorKey> getTargetOps()

setTargetOps

public void setTargetOps(List<OperatorKey> targetOps)

append

public void append(Object val)
Description copied from interface: Tuple
Append a field to a tuple. This method is not efficient as it may force copying of existing data in order to grow the data structure. Whenever possible you should construct your Tuple with TupleFactory.newTuple(int) and then fill in the values with Tuple.set(int, Object), rather than construct it with TupleFactory.newTuple() and append values.

Parameters:
val - Object to append to the tuple.

get

public Object get(int fieldNum)
           throws ExecException
Description copied from interface: Tuple
Get the value in a given field.

Parameters:
fieldNum - Number of the field to get the value for.
Returns:
value, as an Object.
Throws:
ExecException - if the field number is greater than or equal to the number of fields in the tuple.

getAll

public List<Object> getAll()
Description copied from interface: Tuple
Get all of the fields in the tuple as a list.

Returns:
a list of objects containing the fields of the tuple in order.

getMemorySize

public long getMemorySize()
Description copied from interface: Tuple
Determine the size of tuple in memory. This is used by data bags to determine their memory size. This need not be exact, but it should be a decent estimation.

Returns:
estimated memory size, in bytes.

getType

public byte getType(int fieldNum)
             throws ExecException
Description copied from class: AbstractTuple
Find the type of a given field.

Specified by:
getType in interface Tuple
Overrides:
getType in class AbstractTuple
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.

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
Overrides:
reference in class AbstractTuple
Parameters:
t - Tuple to reference.

set

public void set(int fieldNum,
                Object val)
         throws ExecException
Description copied from interface: Tuple
Set the value in a given field. This should not be called unless the tuple was constructed by 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.

Parameters:
fieldNum - Number of the field to set the value for.
val - Object to put in the indicated field.
Throws:
ExecException - if the field number is greater than or equal to the number of fields in the tuple.

size

public int size()
Description copied from interface: Tuple
Find the size of the tuple. Used to be called arity().

Returns:
number of fields in the tuple.

compareTo

public int compareTo(Object o)

equals

public boolean equals(Object o)
Overrides:
equals in class AbstractTuple

hashCode

public int hashCode()
Overrides:
hashCode in class Object


Copyright © 2007-2012 The Apache Software Foundation