public class Tuple extends Object implements Cloneable, MapWriter
MapWriter.EntryWriter
Modifier and Type | Field and Description |
---|---|
boolean |
EOF
When EOF field is true the Tuple marks the end of the stream.
|
boolean |
EXCEPTION
When EXCEPTION field is true the Tuple marks an exception in the stream
and the corresponding "EXCEPTION" field contains a related message.
|
Map<String,String> |
fieldLabels
Deprecated.
use
getFieldLabels() instead of this public field. |
List<String> |
fieldNames
Deprecated.
use
getFieldNames() instead of this public field. |
Map<Object,Object> |
fields
Deprecated.
use
getFields() instead of this public field. |
Constructor and Description |
---|
Tuple() |
Tuple(Map<?,?> fields)
A copy constructor.
|
Tuple(Object... fields)
Constructor that accepts an even number of arguments as key / value pairs.
|
Modifier and Type | Method and Description |
---|---|
Tuple |
clone() |
static Tuple |
EOF()
Create a new empty tuple marked as EOF.
|
static Tuple |
EXCEPTION(String msg,
boolean eof)
Create a new empty tuple marked as EXCEPTION, and optionally EOF.
|
static Tuple |
EXCEPTION(Throwable t,
boolean eof)
Create a new empty tuple marked as EXCEPTION and optionally EOF.
|
Object |
get(Object key) |
Boolean |
getBool(Object key) |
List<Boolean> |
getBools(Object key) |
Date |
getDate(Object key) |
List<Date> |
getDates(Object key) |
Double |
getDouble(Object key) |
List<Double> |
getDoubles(Object key) |
String |
getException() |
Map<String,String> |
getFieldLabels()
This represents the mapping of external field labels to the tuple's
internal field names if they are different from field names.
|
List<String> |
getFieldNames()
A list of field names to serialize.
|
Map<Object,Object> |
getFields()
Return all tuple fields and their values.
|
Long |
getLong(Object key) |
List<Long> |
getLongs(Object key) |
Map |
getMap()
Deprecated.
use
getFields() instead. |
List<Map> |
getMaps(Object key) |
Map<String,Map> |
getMetrics() |
String |
getString(Object key) |
List<String> |
getStrings(Object key) |
void |
merge(Tuple other) |
void |
put(Object key,
Object value) |
void |
remove(Object key) |
void |
setFieldLabels(Map<String,String> fieldLabels) |
void |
setFieldNames(List<String> fieldNames) |
void |
setMaps(Object key,
List<Map> maps) |
void |
setMetrics(Map<String,Map> metrics) |
void |
writeMap(MapWriter.EntryWriter ew) |
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
_forEachEntry, _forEachEntry, _forEachEntry, _get, _get, _getStr, _getStr, _size
public boolean EOF
public boolean EXCEPTION
@Deprecated public Map<Object,Object> fields
getFields()
instead of this public field.@Deprecated public List<String> fieldNames
getFieldNames()
instead of this public field.@Deprecated public Map<String,String> fieldLabels
getFieldLabels()
instead of this public field.public Tuple()
public Tuple(Map<?,?> fields)
fields
- map containing keys and values to be copied to this tuplepublic Tuple(Object... fields)
fields
- a list of key / value pairs, with keys at odd and values at
even positions.public void remove(Object key)
public String getException()
@Deprecated public Map getMap()
getFields()
instead.public Map<String,String> getFieldLabels()
public List<String> getFieldNames()
getFieldLabels()
determines what tuple values
are serialized and their external (serialized) names.public void merge(Tuple other)
public void writeMap(MapWriter.EntryWriter ew) throws IOException
writeMap
in interface MapWriter
IOException
public static Tuple EOF()
public static Tuple EXCEPTION(String msg, boolean eof)
msg
- exception messageeof
- if true the tuple will be marked as EOFCopyright © 2000-2021 Apache Software Foundation. All Rights Reserved.