|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.ebay.erl.mobius.core.model.Tuple
public class Tuple
Represents a record(row) in a dataset.
This product is licensed under the Apache License, Version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0. This product contains portions derived from Apache hadoop which is licensed under the Apache License, Version 2.0, available at http://hadoop.apache.org. © 2007 – 2012 eBay Inc., Evan Chiu, Woody Zhou, Neel Sundaresan
Nested Class Summary | |
---|---|
static class |
Tuple.TupleColumnName
Represents the name of a tuple column. |
Field Summary | |
---|---|
protected java.lang.String |
_INSERT_KEY
key used for synchronizing update activities to this tuple. |
static byte |
BOOLEAN_TYPE
|
static byte |
BYTE_ARRAY_TYPE
Represents byte[]. |
static byte |
BYTE_TYPE
|
protected org.apache.hadoop.conf.Configuration |
conf
Hadoop configuration object. |
static byte |
DATE_TYPE
java.sql.Date, only contains yyyy-mm-dd |
static byte |
DOUBLE_TYPE
|
protected long |
estimate_size_in_bytes
|
static byte |
FLOAT_TYPE
|
static byte |
INTEGER_TYPE
|
protected boolean |
isMutable
|
static byte |
LONG_TYPE
|
protected static java.util.Map<java.lang.String,java.lang.String> |
lowerCases
For quick look up of lower cases form of a given string so we don't to toLowerCase() everytime when retriving or setting value to a tuple |
protected java.util.Map<java.lang.String,java.lang.Integer> |
namesToIdxMapping
a mapping from a column name to an index in the values
array to get it value. |
static Tuple |
NULL
An immutable Tuple which contains only single Column
NULL with null value. |
static byte |
NULL_TYPE
Represents java null . |
static byte |
NULL_WRITABLE_TYPE
represents org.apache.hadoop.io.NullWritable |
static byte |
RESULT_WRAPPER_TYPE
representing value generated by a combiner |
static byte |
SERIALIZABLE_TYPE
Represents Serializable |
static byte |
SHORT_TYPE
|
protected static java.util.Map<java.util.Set<java.lang.String>,java.util.List<java.lang.String>> |
sortedKeys
|
static byte |
STRING_MAP_TYPE
Represents CaseInsensitiveTreeMap type. |
static byte |
STRING_TYPE
|
static byte |
TIME_TYPE
java.sql.Time type, contains hh:mm:ss.[fff] |
static byte |
TIMESTAMP_TYPE
java.sql.Timestamp type, contains yyyy-mm-dd hh:mm:ss.[fff] |
protected java.lang.String[] |
toStringOrdering
|
static byte |
TUPLE_TYPE
Represents com.ebay.erl.mobius.core.model.Tuple type. |
protected java.util.List<java.lang.Object> |
values
to hold the actual values of columns within this mapper. |
static byte |
WRITABLE_TYPE
Represents org.hadoop.hadoop.io.Writable
type. |
Constructor Summary | |
---|---|
Tuple()
|
Method Summary | |
---|---|
protected int |
check_in_schema(java.lang.String name)
Check if the given name exists
in this tuple or not, if so, returns its index. |
Tuple |
clone()
Return a new instance of Tuple which
contains the exact same data of this one. |
int |
compare(byte[] b1,
int s1,
int l1,
byte[] b2,
int s2,
int l2)
compare two tuples in low level row format. |
int |
compare(Tuple t1,
Tuple t2)
Comparing two tuples. |
int |
compareTo(Tuple other)
Compare this tuple with other . |
boolean |
equals(java.lang.Object obj)
Compare if the obj equals to
this tuple or not. |
protected java.lang.Object |
get(byte expecting_type,
java.lang.String name,
java.lang.Object default_value)
Get the value for column name in the
expecting_type . |
protected java.lang.Object |
get(byte expecting_type,
java.lang.String name,
java.lang.Object value,
java.lang.Object default_value)
Get the value of the given column name in
the expecting_type . |
java.lang.Object |
get(int index)
Get value directly using index. |
java.lang.Object |
get(java.lang.String name)
Get the value of column named name . |
java.lang.Boolean |
getBoolean(java.lang.String name)
Get the value of column named name . |
java.lang.Boolean |
getBoolean(java.lang.String name,
boolean default_value)
Get the value of column named name . |
java.lang.Byte |
getByte(java.lang.String name)
Get the value of column named name . |
java.lang.Byte |
getByte(java.lang.String name,
byte default_value)
Get the value of column named name . |
org.apache.hadoop.conf.Configuration |
getConf()
Get Hadoop configuration. |
java.sql.Date |
getDate(java.lang.String name)
Get the value of column named name . |
java.sql.Date |
getDate(java.lang.String name,
java.sql.Date default_value)
Get the value of column named name . |
java.lang.Double |
getDouble(int idx,
double default_value)
Get the value of idx th
column in this tuple. |
java.lang.Double |
getDouble(java.lang.String name)
Get the value of column named name . |
java.lang.Double |
getDouble(java.lang.String name,
double default_value)
Get the value of column named name . |
long |
getEstimatedSizeInMemory()
Return the estimated size in bytes of this tuple in memory. |
java.lang.Float |
getFloat(java.lang.String name)
Get the value of column named name . |
java.lang.Float |
getFloat(java.lang.String name,
float default_value)
Get the value of column named name . |
java.lang.Integer |
getInt(java.lang.String name)
Get the value of column named name . |
java.lang.Integer |
getInt(java.lang.String name,
int default_value)
Get the value of column named name . |
java.lang.Long |
getLong(java.lang.String name)
Get the value of column named name . |
java.lang.Long |
getLong(java.lang.String name,
long default_value)
Get the value of column named name . |
java.util.Map<java.lang.String,java.lang.String> |
getMap(java.lang.String name)
Get the value of column named name . |
java.lang.String[] |
getSchema()
Return the schema of this column. |
java.lang.Short |
getShort(java.lang.String name)
Get the value of column named name . |
java.lang.Short |
getShort(java.lang.String name,
short default_value)
Get the value of column named name . |
protected static java.util.List<java.lang.String> |
getSorted(java.util.Set<java.lang.String> aKeySet)
|
java.lang.String |
getString(java.lang.String name)
Get the value of column named name . |
java.lang.String |
getString(java.lang.String name,
java.lang.String default_value)
Get the value of column named name . |
java.sql.Time |
getTime(java.lang.String name)
Get the value of column named name . |
java.sql.Time |
getTime(java.lang.String name,
java.sql.Time default_value)
Get the value of column named name . |
java.sql.Timestamp |
getTimestamp(java.lang.String name)
Get the value of column named name . |
java.sql.Timestamp |
getTimestamp(java.lang.String name,
java.sql.Timestamp default_value)
Get the value of column named name . |
static byte |
getType(java.lang.Object obj)
Get the type of the given obj
in byte format, one of the
supported type in Tuple. |
static java.lang.String |
getTypeString(byte type)
Get the readable string representation for a given type. |
int |
hashCode()
|
boolean |
hasSchema()
|
static Tuple |
immutable(Tuple t)
return a new instance of tuple that contains the same data of the given t tuple, but
reject all modification requests, such as
insert(String, Object) . |
Tuple |
insert(java.lang.String name,
java.lang.Object value)
Add a new column in the given with
provided value . |
static boolean |
isDateType(byte type)
Test if the given type is
TIME_TYPE , DATE_TYPE , or
TIMESTAMP_TYPE . |
static boolean |
isNumericalType(byte type)
Test if the given type is
BYTE_TYPE , SHORT_TYPE ,
INTEGER_TYPE , LONG_TYPE ,
FLOAT_TYPE , or DOUBLE_TYPE . |
protected static java.lang.String |
lowerCase(java.lang.String key)
|
static void |
main(java.lang.String[] arg)
|
static Tuple |
merge(Tuple t1,
Tuple t2)
Merge the tuples together, and return a new tuple represents the merged result. |
Tuple |
put(java.lang.String name,
boolean value)
For the given column named name ,
add (if it doesn't exist) to this tuple or update (if it
exists) its value to the given value . |
Tuple |
put(java.lang.String name,
byte value)
For the given column named name ,
add (if it doesn't exist) to this tuple or update (if it
exists) its value to the given value . |
Tuple |
put(java.lang.String name,
byte[] value)
For the given column named name ,
add (if it doesn't exist) to this tuple or update (if it
exists) its value to the given value . |
Tuple |
put(java.lang.String name,
CaseInsensitiveTreeMap value)
For the given column named name ,
add (if it doesn't exist) to this tuple or update (if it
exists) its value to the given value . |
Tuple |
put(java.lang.String name,
java.sql.Date value)
For the given column named name ,
add (if it doesn't exist) to this tuple or update (if it
exists) its value to the given value . |
Tuple |
put(java.lang.String name,
double value)
For the given column named name ,
add (if it doesn't exist) to this tuple or update (if it
exists) its value to the given value . |
Tuple |
put(java.lang.String name,
float value)
For the given column named name ,
add (if it doesn't exist) to this tuple or update (if it
exists) its value to the given value . |
Tuple |
put(java.lang.String name,
int value)
For the given column named name ,
add (if it doesn't exist) to this tuple or update (if it
exists) its value to the given value . |
Tuple |
put(java.lang.String name,
long value)
For the given column named name ,
add (if it doesn't exist) to this tuple or update (if it
exists) its value to the given value . |
Tuple |
put(java.lang.String name,
ResultWrapper<?> v)
|
Tuple |
put(java.lang.String name,
java.io.Serializable value)
For the given column named name ,
add (if it doesn't exist) to this tuple or update (if it
exists) its value to the given value . |
Tuple |
put(java.lang.String name,
short value)
For the given column named name ,
add (if it doesn't exist) to this tuple or update (if it
exists) its value to the given value . |
Tuple |
put(java.lang.String name,
java.lang.String value)
For the given column named name ,
add (if it doesn't exist) to this tuple or update (if it
exists) its value to the given value . |
Tuple |
put(java.lang.String name,
java.sql.Time value)
For the given column named name ,
add (if it doesn't exist) to this tuple or update (if it
exists) its value to the given value . |
Tuple |
put(java.lang.String name,
java.sql.Timestamp value)
For the given column named name ,
add (if it doesn't exist) to this tuple or update (if it
exists) its value to the given value . |
Tuple |
put(java.lang.String name,
org.apache.hadoop.io.Writable value)
For the given column named name ,
add (if it doesn't exist) to this tuple or update (if it
exists) its value to the given value . |
Tuple |
putNull(java.lang.String name)
For the given column named name ,
add (if it doesn't exist) to this tuple or update (if it
exists) its value to null . |
void |
readFields(java.io.DataInput in)
Deserialize the tuple from the input in . |
void |
setConf(org.apache.hadoop.conf.Configuration conf)
Set the Hadoop configuration, the delimiter to be used to separated the column value in the toString()
is also set here. |
void |
setSchema(java.lang.String[] schema)
To set the schema of this tuple. |
void |
setToStringOrdering(java.lang.String[] columns)
|
java.lang.String |
toString()
Convert this Tuple into text, the delimiter is specified by
"mobius.tuple.tostring.delimiter" (default is tab). |
static Tuple |
valueOf(org.apache.hadoop.io.Text source,
java.lang.String[] schema,
java.lang.String delimiter)
Convert the source into a tuple. |
void |
write(java.io.DataOutput out)
Serialize this tuple to the output out . |
Methods inherited from class java.lang.Object |
---|
finalize, getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
protected long estimate_size_in_bytes
public static final byte BYTE_TYPE
public static final byte SHORT_TYPE
public static final byte INTEGER_TYPE
public static final byte LONG_TYPE
public static final byte FLOAT_TYPE
public static final byte DOUBLE_TYPE
public static final byte STRING_TYPE
public static final byte DATE_TYPE
public static final byte TIMESTAMP_TYPE
public static final byte TIME_TYPE
public static final byte BOOLEAN_TYPE
public static final byte RESULT_WRAPPER_TYPE
public static final byte NULL_WRITABLE_TYPE
public static final byte TUPLE_TYPE
public static final byte BYTE_ARRAY_TYPE
public static final byte STRING_MAP_TYPE
CaseInsensitiveTreeMap
type.
public static final byte WRITABLE_TYPE
org.hadoop.hadoop.io.Writable
type.
public static final byte SERIALIZABLE_TYPE
Serializable
public static final byte NULL_TYPE
null
.
protected java.util.Map<java.lang.String,java.lang.Integer> namesToIdxMapping
values
array to get it value.
protected java.util.List<java.lang.Object> values
protected final java.lang.String _INSERT_KEY
protected org.apache.hadoop.conf.Configuration conf
protected boolean isMutable
protected static java.util.Map<java.lang.String,java.lang.String> lowerCases
protected static java.util.Map<java.util.Set<java.lang.String>,java.util.List<java.lang.String>> sortedKeys
public static final Tuple NULL
Tuple
which contains only single Column
NULL with null value.
protected java.lang.String[] toStringOrdering
Constructor Detail |
---|
public Tuple()
Method Detail |
---|
public static void main(java.lang.String[] arg) throws java.lang.Throwable
java.lang.Throwable
protected static java.lang.String lowerCase(java.lang.String key)
protected static java.util.List<java.lang.String> getSorted(java.util.Set<java.lang.String> aKeySet)
public void setSchema(java.lang.String[] schema)
This method is called when deserialize a tuple from disk, and should be called only in that case.
The ordering of the schema
is
sorted first then set into this tuple. It
it because when a tuple is being serialize to
disk, the values are extracted according to
the order of their name. So when deserialize
it back, the schema need to be sorted first
and then set.
The reason of doing this is because Mobius stores the schema in hadoop configuration, but the user might create Tuples with the same schema but in different ordering (insert the values in the different order than the defined schema). To solve this problem, Mobius always serialize the values in a tuple according to their schema name order, so it can be deserialized back always in the right schema.
protected int check_in_schema(java.lang.String name)
name
exists
in this tuple or not, if so, returns its index.
name
is in the
schema of this tuple, the index of the schema
is returned. Otherwise, IllegalArgumentException
is thrown.protected java.lang.Object get(byte expecting_type, java.lang.String name, java.lang.Object value, java.lang.Object default_value)
name
in
the expecting_type
.
If the original value
is not in the exact
same expecting_type
, Mobius will try to
convert it to the expecting_type
and return
it.
If the original value
is null, then
default_value
is returned.
expecting_type
- user specified type for the returned value.name
- the name of a column within this tuple.value
- the original value of the column name
default_value
- if the original value is null, then default_value
is returned.
protected java.lang.Object get(byte expecting_type, java.lang.String name, java.lang.Object default_value)
name
in the
expecting_type
.
expecting_type
- the type of the returned object.name
- name of a column in this tuple.default_value
- if the value of the column is null, then
default_value
is returned.
expected_type
of column
name
public java.lang.Double getDouble(int idx, double default_value)
idx
th
column in this tuple.
If the value of that column is not double, Mobius will
try to convert it to double if possible, otherwise,
NumberFormatException
will be thrown.
idx
- index to a column in this tuple, starts from 0.default_value
- if the value of the column is null,
then default_value
is returned.
public static java.lang.String getTypeString(byte type)
type
- type supported by Tuple.
type
.public static byte getType(java.lang.Object obj)
obj
in byte
format, one of the
supported type in Tuple.
public void readFields(java.io.DataInput in) throws java.io.IOException
in
.
readFields
in interface org.apache.hadoop.io.Writable
java.io.IOException
public void write(java.io.DataOutput out) throws java.io.IOException
out
.
When serialize, the values are stored in the order
of schema name's ordering. See setSchema(String[])
for more explanation.
write
in interface org.apache.hadoop.io.Writable
java.io.IOException
public int compareTo(Tuple other)
other
.
It calls compare(Tuple, Tuple)
underline.
compareTo
in interface java.lang.Comparable<Tuple>
public Tuple insert(java.lang.String name, java.lang.Object value)
with
provided value
.
java.lang.UnsupportedOperationException
- if this tuple is immutable.public org.apache.hadoop.conf.Configuration getConf()
getConf
in interface org.apache.hadoop.conf.Configurable
public void setConf(org.apache.hadoop.conf.Configuration conf)
toString()
is also set here.
The default delimiter is tab, unless
ConfigureConstants.TUPLE_TO_STRING_DELIMITER
is set by user.
setConf
in interface org.apache.hadoop.conf.Configurable
public int compare(byte[] b1, int s1, int l1, byte[] b2, int s2, int l2)
compare
in interface org.apache.hadoop.io.RawComparator<Tuple>
public int compare(Tuple t1, Tuple t2)
It compares the values of the two tuples one by one in sequence, and as long as there is a difference between two values, then the difference is returned.
If the number of values in the tuples are different, the values are compared up to the boundary of the smaller size tuple. If all the values before the boundary have no differences, then the smaller size tuple is considered to be placed before the bigger size tuple.
compare
in interface java.util.Comparator<Tuple>
public Tuple put(java.lang.String name, ResultWrapper<?> v)
public Tuple putNull(java.lang.String name)
name
,
add (if it doesn't exist) to this tuple or update (if it
exists) its value to null
.
public Tuple put(java.lang.String name, byte value)
name
,
add (if it doesn't exist) to this tuple or update (if it
exists) its value to the given value
.
public Tuple put(java.lang.String name, byte[] value)
name
,
add (if it doesn't exist) to this tuple or update (if it
exists) its value to the given value
.
public Tuple put(java.lang.String name, short value)
name
,
add (if it doesn't exist) to this tuple or update (if it
exists) its value to the given value
.
public Tuple put(java.lang.String name, int value)
name
,
add (if it doesn't exist) to this tuple or update (if it
exists) its value to the given value
.
public Tuple put(java.lang.String name, long value)
name
,
add (if it doesn't exist) to this tuple or update (if it
exists) its value to the given value
.
public Tuple put(java.lang.String name, float value)
name
,
add (if it doesn't exist) to this tuple or update (if it
exists) its value to the given value
.
public Tuple put(java.lang.String name, double value)
name
,
add (if it doesn't exist) to this tuple or update (if it
exists) its value to the given value
.
public Tuple put(java.lang.String name, boolean value)
name
,
add (if it doesn't exist) to this tuple or update (if it
exists) its value to the given value
.
public Tuple put(java.lang.String name, java.sql.Date value)
name
,
add (if it doesn't exist) to this tuple or update (if it
exists) its value to the given value
.
public Tuple put(java.lang.String name, java.sql.Timestamp value)
name
,
add (if it doesn't exist) to this tuple or update (if it
exists) its value to the given value
.
public Tuple put(java.lang.String name, java.sql.Time value)
name
,
add (if it doesn't exist) to this tuple or update (if it
exists) its value to the given value
.
public Tuple put(java.lang.String name, java.lang.String value)
name
,
add (if it doesn't exist) to this tuple or update (if it
exists) its value to the given value
.
public Tuple put(java.lang.String name, CaseInsensitiveTreeMap value)
name
,
add (if it doesn't exist) to this tuple or update (if it
exists) its value to the given value
.
public Tuple put(java.lang.String name, org.apache.hadoop.io.Writable value)
name
,
add (if it doesn't exist) to this tuple or update (if it
exists) its value to the given value
.
public Tuple put(java.lang.String name, java.io.Serializable value)
name
,
add (if it doesn't exist) to this tuple or update (if it
exists) its value to the given value
.
java.lang.IllegalArgumentException
- if value
is instance
of Map but not CaseInsensitiveTreeMap
. Or when value
doesn't implement Comparable
public java.lang.Short getShort(java.lang.String name)
name
.
If the value is null
, -1 is returned.
If the value is not null
, but it's
not a short type, Mobius will try to convert it
to short, otherwise, NumberFormatException
is thrown.
public java.lang.Short getShort(java.lang.String name, short default_value)
name
.
If the value is null
, default_value
is returned.
If the value is not null
, but it's
not a short type, Mobius will try to convert it
to short, otherwise, NumberFormatException
is thrown.
public java.lang.Integer getInt(java.lang.String name)
name
.
If the value is null
, -1 is returned.
If the value is not null
, but it's
not a short type, Mobius will try to convert it
to short, otherwise, NumberFormatException
is thrown.
public java.lang.Integer getInt(java.lang.String name, int default_value)
name
.
If the value is null
, default_value
is returned.
If the value is not null
, but it's
not an integer type, Mobius will try to convert it
to integer, otherwise, NumberFormatException
is thrown.
public java.lang.Long getLong(java.lang.String name)
name
.
If the value is null
, -1L is returned.
If the value is not null
, but it's
not a long type, Mobius will try to convert it
to long, otherwise, NumberFormatException
is thrown.
public java.lang.Long getLong(java.lang.String name, long default_value)
name
.
If the value is null
, default_value
is returned.
If the value is not null
, but it's
not a long type, Mobius will try to convert it
to long, otherwise, NumberFormatException
is thrown.
public java.lang.Float getFloat(java.lang.String name)
name
.
If the value is null
, -1F is returned.
If the value is not null
, but it's
not a float type, Mobius will try to convert it
to float, otherwise, NumberFormatException
is thrown.
public java.lang.Float getFloat(java.lang.String name, float default_value)
name
.
If the value is null
, default_value
is returned.
If the value is not null
, but it's
not a float type, Mobius will try to convert it
to float, otherwise, NumberFormatException
is thrown.
public java.lang.Double getDouble(java.lang.String name)
name
.
If the value is null
, -1D is returned.
If the value is not null
, but it's
not a double type, Mobius will try to convert it
to double, otherwise, NumberFormatException
is thrown.
public java.lang.Double getDouble(java.lang.String name, double default_value)
name
.
If the value is null
, default_value
is returned.
If the value is not null
, but it's
not a double type, Mobius will try to convert it
to double, otherwise, NumberFormatException
is thrown.
public java.lang.Byte getByte(java.lang.String name)
name
.
If the value is null
, 0x00 is returned.
If the value is not null
, but it's
not a byte type, Mobius will try to convert it
to byte, otherwise, NumberFormatException
is thrown.
public java.lang.Byte getByte(java.lang.String name, byte default_value)
name
.
If the value is null
, default_value
is returned.
If the value is not null
, but it's
not a byte type, Mobius will try to convert it
to byte, otherwise, NumberFormatException
is thrown.
public java.lang.Boolean getBoolean(java.lang.String name)
name
.
If the value is null
, false
is returned.
If the value is not null
, but it's
not a boolean type, Mobius will try to convert it
to using Boolean.valueOf(String)
.
public java.lang.Boolean getBoolean(java.lang.String name, boolean default_value)
name
.
If the value is null
, default_value
is returned.
If the value is not null
, but it's
not a boolean type, Mobius will try to convert it
to using Boolean.valueOf(String)
.
public java.lang.String getString(java.lang.String name)
name
.
If the value is null
, null
is still returned.
If the value is not null
, but it's
not a string type, Mobius will try to convert it
to using the toString()
method.
public java.lang.String getString(java.lang.String name, java.lang.String default_value)
name
.
If the value is null
, default_value
is returned.
If the value is not null
, but it's
not a string type, Mobius will try to convert it
to using the toString()
method.
public java.util.Map<java.lang.String,java.lang.String> getMap(java.lang.String name)
name
.
If the value is null
, null
is still returned.
If the value is not null
, but it's
not a map type, IllegalArgumentException
is thrown.
public java.sql.Date getDate(java.lang.String name)
name
.
If the value is null
, null
is still returned.
If the value is not null
, but it's
not a date type, Mobius will try to convert it
to using the Date.valueOf(String)
method.
public java.sql.Date getDate(java.lang.String name, java.sql.Date default_value)
name
.
If the value is null
, default_value
is returned.
If the value is not null
, but it's
not a date type, Mobius will try to convert it
to using the Date.valueOf(String)
method.
public java.sql.Timestamp getTimestamp(java.lang.String name)
name
.
If the value is null
, null
is still returned.
If the value is not null
, but it's
not a date type, Mobius will try to convert it
to using the Timestamp.valueOf(String)
method.
public java.sql.Timestamp getTimestamp(java.lang.String name, java.sql.Timestamp default_value)
name
.
If the value is null
, default_value
is returned.
If the value is not null
, but it's
not a date type, Mobius will try to convert it
to using the Timestamp.valueOf(String)
method.
public java.sql.Time getTime(java.lang.String name)
name
.
If the value is null
, null
is still returned.
If the value is not null
, but it's
not a date type, Mobius will try to convert it
to using the Time.valueOf(String)
method.
public java.sql.Time getTime(java.lang.String name, java.sql.Time default_value)
name
.
If the value is null
, default_value
is returned.
If the value is not null
, but it's
not a date type, Mobius will try to convert it
to using the Time.valueOf(String)
method.
public java.lang.Object get(int index)
public java.lang.Object get(java.lang.String name)
name
.
name
- the name of a column.
public Tuple clone()
Tuple
which
contains the exact same data of this one.
clone
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
public static boolean isNumericalType(byte type)
type
is
BYTE_TYPE
, SHORT_TYPE
,
INTEGER_TYPE
, LONG_TYPE
,
FLOAT_TYPE
, or DOUBLE_TYPE
.
Return true
if the type
is within the above types, false otherwise.
public static boolean isDateType(byte type)
type
is
TIME_TYPE
, DATE_TYPE
, or
TIMESTAMP_TYPE
.
Return true
if the type
is within the above types, false otherwise.
public static Tuple immutable(Tuple t)
t
tuple, but
reject all modification requests, such as
insert(String, Object)
.
Note that, this method return a new instance, the
original t
tuple is still a mutable
Tuple.
public static Tuple merge(Tuple t1, Tuple t2)
All the columns in t1
and
t2
will be put together into
the returned Tuple. If there are columns
in t2
also appear in t1
,
then values from t2
of those columns
will be used instead of the values in t1
.
public java.lang.String toString()
Tuple
into text, the delimiter is specified by
"mobius.tuple.tostring.delimiter" (default is tab).
toString
in class java.lang.Object
public boolean equals(java.lang.Object obj)
obj
equals to
this tuple or not.
Equals only whe the class of this tuple and the
obj
is the same, both share same
schema, and the values of the columns are the same.
equals
in interface java.util.Comparator<Tuple>
equals
in class java.lang.Object
public java.lang.String[] getSchema()
public static Tuple valueOf(org.apache.hadoop.io.Text source, java.lang.String[] schema, java.lang.String delimiter)
source
into a tuple.
Split the source
with the given delimiter
,
and use them as the values to the returned tuple, then set the
schema to the tuple.
The ordering of the schema shall be the same as the ordering of the
values from the splitted source
.
If the number of values in the splitted
source
is greater
than the length of
schema
, IDX_$i
is used
as the name of those value, where $i
starts from the
length of schema
.
public long getEstimatedSizeInMemory()
This calculation is based on 64bit VM.
public void setToStringOrdering(java.lang.String[] columns)
public boolean hasSchema()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |