org.apache.pig.data
Class AppendableSchemaTuple<T extends AppendableSchemaTuple<T>>

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

@InterfaceAudience.Public
@InterfaceStability.Unstable
public abstract class AppendableSchemaTuple<T extends AppendableSchemaTuple<T>>
extends SchemaTuple<T>

See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class org.apache.pig.data.SchemaTuple
SchemaTuple.SchemaTupleQuickGenerator<A>
 
Field Summary
 
Fields inherited from interface org.apache.pig.data.Tuple
NOTNULL, NULL
 
Constructor Summary
AppendableSchemaTuple()
           
 
Method Summary
 void append(Object val)
          Append a field to a tuple.
protected  int appendedFieldsSize()
           
protected  int compareTo(SchemaTuple<?> t, boolean checkType)
           
protected  int compareToSpecific(T t)
           
 Object get(int fieldNum)
          Get the value in a given field.
protected  Object getAppendedField(int i)
           
 Tuple getAppendedFields()
           
 long getMemorySize()
          This adds the additional overhead of the append Tuple
 byte getType(int fieldNum)
          Find the type of a given field.
protected  Object getTypeAwareBase(int fieldNum, String type)
           
 int hashCode()
           
protected  boolean isAppendedFieldsNull()
           
 boolean isNull(int fieldNum)
          Find out if a given field is null.
 void readFields(DataInput in)
           
 void set(int fieldNum, Object val)
          Set the value in a given field.
 SchemaTuple<T> set(List<Object> l)
           
protected  SchemaTuple<T> set(SchemaTuple<?> t, boolean checkType)
           
protected  void setAppendedFields(Tuple t)
           
protected  SchemaTuple<T> setSpecific(T t)
           
protected  void setTypeAwareBase(int fieldNum, Object val, String type)
           
 int size()
          Find the size of the tuple.
protected  void writeElements(DataOutput out)
          This method is responsible for writing everything contained by the Tuple.
 
Methods inherited from class org.apache.pig.data.SchemaTuple
box, box, box, box, box, box, box, box, box, box, box, box, box, compare, compare, compare, compare, compare, compare, compare, compare, compare, compare, compare, compare, compare, compare, compare, compare, compare, compare, compare, compare, compare, compare, compare, compare, compare, compareElementAtPos, compareNull, compareNull, compareSize, compareTo, compareTo, compareTo, compareTo, compareWithElementAtPos, compareWithElementAtPos, compareWithElementAtPos, compareWithElementAtPos, compareWithElementAtPos, compareWithElementAtPos, compareWithElementAtPos, compareWithElementAtPos, compareWithElementAtPos, compareWithElementAtPos, compareWithElementAtPos, compareWithElementAtPos, compareWithElementAtPos, equals, generatedCodeCompareTo, generatedCodeCompareToSpecific, generatedCodeGetBigDecimal, generatedCodeGetBigInteger, generatedCodeGetBoolean, generatedCodeGetBytes, generatedCodeGetDataBag, generatedCodeGetDateTime, generatedCodeGetDouble, generatedCodeGetField, generatedCodeGetFloat, generatedCodeGetInt, generatedCodeGetLong, generatedCodeGetMap, generatedCodeGetString, generatedCodeGetTuple, generatedCodeHashCode, generatedCodeNullsArray, generatedCodeReadFields, generatedCodeSet, generatedCodeSetBigDecimal, generatedCodeSetBigInteger, generatedCodeSetBoolean, generatedCodeSetBytes, generatedCodeSetDataBag, generatedCodeSetDateTime, generatedCodeSetDouble, generatedCodeSetField, generatedCodeSetFloat, generatedCodeSetInt, generatedCodeSetIterator, generatedCodeSetLong, generatedCodeSetMap, generatedCodeSetSpecific, generatedCodeSetString, generatedCodeSetTuple, generatedCodeSize, generatedCodeWriteElements, getAll, getBigDecimal, getBigInteger, getBoolean, getBytes, getDataBag, getDateTime, getDouble, getFloat, getGeneratedCodeFieldType, getGeneratedCodeMemorySize, getInt, getLong, getMap, getQuickGenerator, getSchemaString, getSchemaTupleIdentifier, getString, getTuple, hashCodePiece, hashCodePiece, hashCodePiece, hashCodePiece, hashCodePiece, hashCodePiece, hashCodePiece, hashCodePiece, hashCodePiece, hashCodePiece, hashCodePiece, hashCodePiece, hashCodePiece, isGeneratedCodeFieldNull, isSpecificSchemaTuple, read, read, read, read, read, read, read, read, read, read, read, reference, returnUnlessNull, returnUnlessNull, returnUnlessNull, returnUnlessNull, returnUnlessNull, returnUnlessNull, returnUnlessNull, returnUnlessNull, returnUnlessNull, returnUnlessNull, returnUnlessNull, returnUnlessNull, returnUnlessNull, schemaSize, set, set, set, setAndCatch, setAndCatch, setBigDecimal, setBigInteger, setBoolean, setBytes, setDataBag, setDateTime, setDouble, setFloat, setInt, setLong, setMap, setString, setTuple, staticSchemaGen, unbox, unbox, unbox, unbox, unbox, unbox, unbox, unbox, unbox, unbox, unbox, unbox, unbox, unbox, unbox, unbox, unbox, unbox, unbox, unbox, unbox, unbox, unboxBigDecimal, unboxBigInteger, unboxBoolean, unboxBytes, unboxDataBag, unboxDateTime, unboxDouble, unboxFloat, unboxInt, unboxLong, unboxMap, unboxString, unboxTuple, write, write, write, write, write, write, write, write, write, write, write, write, write, write
 
Methods inherited from class org.apache.pig.data.AbstractTuple
iterator, toDelimitedString, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.apache.pig.data.TypeAwareTuple
getSchema
 
Methods inherited from interface org.apache.pig.data.Tuple
toDelimitedString
 
Methods inherited from interface java.lang.Iterable
iterator
 

Constructor Detail

AppendableSchemaTuple

public AppendableSchemaTuple()
Method Detail

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.

Specified by:
append in interface Tuple
Overrides:
append in class SchemaTuple<T extends AppendableSchemaTuple<T>>
Parameters:
val - Object to append to the tuple.

appendedFieldsSize

protected int appendedFieldsSize()

isAppendedFieldsNull

protected boolean isAppendedFieldsNull()

getAppendedField

protected Object getAppendedField(int i)
                           throws ExecException
Throws:
ExecException

getAppendedFields

public Tuple getAppendedFields()

setAppendedFields

protected void setAppendedFields(Tuple t)

getMemorySize

public long getMemorySize()
This adds the additional overhead of the append Tuple

Specified by:
getMemorySize in interface Tuple
Overrides:
getMemorySize in class SchemaTuple<T extends AppendableSchemaTuple<T>>
Returns:
estimated memory size, in bytes.

set

protected SchemaTuple<T> set(SchemaTuple<?> t,
                             boolean checkType)
                                                       throws ExecException
Overrides:
set in class SchemaTuple<T extends AppendableSchemaTuple<T>>
Throws:
ExecException

setSpecific

protected SchemaTuple<T> setSpecific(T t)
Overrides:
setSpecific in class SchemaTuple<T extends AppendableSchemaTuple<T>>

set

public SchemaTuple<T> set(List<Object> l)
                                                    throws ExecException
Overrides:
set in class SchemaTuple<T extends AppendableSchemaTuple<T>>
Throws:
ExecException

compareTo

protected int compareTo(SchemaTuple<?> t,
                        boolean checkType)
Overrides:
compareTo in class SchemaTuple<T extends AppendableSchemaTuple<T>>

compareToSpecific

protected int compareToSpecific(T t)
Overrides:
compareToSpecific in class SchemaTuple<T extends AppendableSchemaTuple<T>>

hashCode

public int hashCode()
Overrides:
hashCode in class SchemaTuple<T extends AppendableSchemaTuple<T>>

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.

Specified by:
set in interface Tuple
Overrides:
set in class SchemaTuple<T extends AppendableSchemaTuple<T>>
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.

get

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

Specified by:
get in interface Tuple
Overrides:
get in class SchemaTuple<T extends AppendableSchemaTuple<T>>
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.

isNull

public boolean isNull(int fieldNum)
               throws ExecException
Description copied from class: AbstractTuple
Find out if a given field is null.

Specified by:
isNull in interface Tuple
Overrides:
isNull in class SchemaTuple<T extends AppendableSchemaTuple<T>>
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.

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 SchemaTuple<T extends AppendableSchemaTuple<T>>
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.

setTypeAwareBase

protected void setTypeAwareBase(int fieldNum,
                                Object val,
                                String type)
                         throws ExecException
Overrides:
setTypeAwareBase in class SchemaTuple<T extends AppendableSchemaTuple<T>>
Throws:
ExecException

getTypeAwareBase

protected Object getTypeAwareBase(int fieldNum,
                                  String type)
                           throws ExecException
Overrides:
getTypeAwareBase in class SchemaTuple<T extends AppendableSchemaTuple<T>>
Throws:
ExecException

writeElements

protected void writeElements(DataOutput out)
                      throws IOException
Description copied from class: SchemaTuple
This method is responsible for writing everything contained by the Tuple. Note that the base SchemaTuple class does not have an implementation (but is not abstract) so that the generated code can call this method via super without worrying about whether it is abstract or not, as there may be classes in between in the inheritance tree (such as AppendableSchemaTuple).

Overrides:
writeElements in class SchemaTuple<T extends AppendableSchemaTuple<T>>
Throws:
IOException

size

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

Specified by:
size in interface Tuple
Overrides:
size in class SchemaTuple<T extends AppendableSchemaTuple<T>>
Returns:
number of fields in the tuple.

readFields

public void readFields(DataInput in)
                throws IOException
Specified by:
readFields in interface org.apache.hadoop.io.Writable
Overrides:
readFields in class SchemaTuple<T extends AppendableSchemaTuple<T>>
Throws:
IOException


Copyright © 2007-2012 The Apache Software Foundation