T
- The type of the Avro objectpublic final class AvroTupleWrapper<T extends org.apache.avro.generic.IndexedRecord> extends java.lang.Object implements Tuple
Constructor and Description |
---|
AvroTupleWrapper(T o)
Creates a new AvroTupleWrapper object.
|
Modifier and Type | Method and Description |
---|---|
void |
append(java.lang.Object o)
Append a field to a tuple.
|
int |
compareTo(java.lang.Object o) |
java.lang.Object |
get(int pos)
Get the value in a given field.
|
java.util.List<java.lang.Object> |
getAll()
Get all of the fields in the tuple as a list.
|
long |
getMemorySize()
Determine the size of tuple in memory.
|
static java.lang.Object |
getPigObject(java.lang.Object o) |
byte |
getType(int arg0)
Find the type of a given field.
|
boolean |
isNull(int arg0)
Find out if a given field is null.
|
java.util.Iterator<java.lang.Object> |
iterator() |
void |
readFields(java.io.DataInput d) |
void |
reference(Tuple arg0)
Make this tuple reference the contents of another.
|
void |
set(int arg0,
java.lang.Object arg1)
Set the value in a given field.
|
int |
size()
Find the size of the tuple.
|
java.lang.String |
toDelimitedString(java.lang.String arg0)
Write a tuple of values into a string.
|
void |
write(java.io.DataOutput out) |
public AvroTupleWrapper(T o)
o
- The object to wrappublic void write(java.io.DataOutput out) throws java.io.IOException
write
in interface org.apache.hadoop.io.Writable
java.io.IOException
public int compareTo(java.lang.Object o)
compareTo
in interface java.lang.Comparable
public void append(java.lang.Object o)
Tuple
TupleFactory.newTuple(int)
and then fill in the values with
Tuple.set(int, Object)
, rather
than construct it with TupleFactory.newTuple()
and append values.public java.lang.Object get(int pos) throws ExecException
Tuple
get
in interface Tuple
pos
- 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.public static java.lang.Object getPigObject(java.lang.Object o)
o
- An Avro object to convert to an equivalent type in Pigpublic java.util.List<java.lang.Object> getAll()
Tuple
public long getMemorySize()
Tuple
getMemorySize
in interface Tuple
public byte getType(int arg0) throws ExecException
Tuple
getType
in interface Tuple
arg0
- 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.public boolean isNull(int arg0) throws ExecException
Tuple
isNull
in interface Tuple
arg0
- 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.public void reference(Tuple arg0)
Tuple
public void set(int arg0, java.lang.Object arg1) throws ExecException
Tuple
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.set
in interface Tuple
arg0
- Number of the field to set the value for.arg1
- 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.public int size()
Tuple
public java.lang.String toDelimitedString(java.lang.String arg0) throws ExecException
Tuple
toDelimitedString
in interface Tuple
arg0
- Delimiter to use in the string.ExecException
- this is never thrown. This only exists for backwards compatability reasons.public void readFields(java.io.DataInput d) throws java.io.IOException
readFields
in interface org.apache.hadoop.io.Writable
java.io.IOException
public java.util.Iterator<java.lang.Object> iterator()
iterator
in interface java.lang.Iterable<java.lang.Object>
Copyright © 2007-2017 The Apache Software Foundation