org.apache.pig.data
Class Tuple
java.lang.Object
org.apache.pig.data.Datum
org.apache.pig.data.Tuple
- All Implemented Interfaces:
- Comparable, org.apache.hadoop.io.Writable, org.apache.hadoop.io.WritableComparable
- Direct Known Subclasses:
- AmendableTuple, DataBag.BagDelimiterTuple, ExampleTuple, IndexedTuple, TimestampedTuple
public class Tuple
- extends Datum
- implements org.apache.hadoop.io.WritableComparable
an ordered list of Datums
fields
protected ArrayList<Datum> fields
Tuple
public Tuple()
Tuple
public Tuple(int numFields)
Tuple
public Tuple(List<Datum> fieldsIn)
Tuple
public Tuple(Datum fieldIn)
- shortcut, if tuple only has one field
Tuple
public Tuple(String textLine,
String delimiter)
- Creates a tuple from a delimited line of text
- Parameters:
textLine
- the line containing fields of datadelimiter
- the delimiter (normal string, NO REGEX!!)
Tuple
public Tuple(String textLine)
- Creates a tuple from a delimited line of text. This will invoke Tuple(textLine, null)
- Parameters:
textLine
- the line containing fields of data
Tuple
public Tuple(Tuple[] otherTs)
copyFrom
public void copyFrom(Tuple otherT)
arity
public int arity()
toString
public String toString()
- Overrides:
toString
in class Object
setField
public void setField(int i,
Datum val)
setField
public void setField(int i,
int val)
setField
public void setField(int i,
double val)
setField
public void setField(int i,
String val)
getField
public Datum getField(int i)
getAtomField
public DataAtom getAtomField(int i)
getTupleField
public Tuple getTupleField(int i)
getBagField
public DataBag getBagField(int i)
appendTuple
public void appendTuple(Tuple other)
appendField
public void appendField(Datum newField)
toDelimitedString
public String toDelimitedString(String delim)
throws IOException
- Throws:
IOException
lessThan
public boolean lessThan(Tuple other)
greaterThan
public boolean greaterThan(Tuple other)
equals
public boolean equals(Object other)
- Specified by:
equals
in class Datum
compareTo
public int compareTo(Tuple other)
compareTo
public int compareTo(Object other)
- Specified by:
compareTo
in interface Comparable
hashCode
public int hashCode()
- Overrides:
hashCode
in class Object
write
public void write(DataOutput out)
throws IOException
- Specified by:
write
in interface org.apache.hadoop.io.Writable
- Specified by:
write
in class Datum
- Throws:
IOException
readFields
public void readFields(DataInput in)
throws IOException
- Specified by:
readFields
in interface org.apache.hadoop.io.Writable
- Throws:
IOException
read
public static Tuple read(DataInput in)
throws IOException
- Throws:
IOException
readDatum
public static Datum readDatum(DataInput in)
throws IOException
- Throws:
IOException
getMemorySize
public long getMemorySize()
- Specified by:
getMemorySize
in class Datum
Copyright © ${year} The Apache Software Foundation