com.ebay.erl.mobius.core.model
Class KeyTuple

java.lang.Object
  extended by com.ebay.erl.mobius.core.model.Tuple
      extended by com.ebay.erl.mobius.core.model.KeyTuple
All Implemented Interfaces:
java.lang.Cloneable, java.lang.Comparable<Tuple>, java.util.Comparator<Tuple>, org.apache.hadoop.conf.Configurable, org.apache.hadoop.io.RawComparator<Tuple>, org.apache.hadoop.io.Writable, org.apache.hadoop.io.WritableComparable<Tuple>

public class KeyTuple
extends Tuple

Same as Tuple, only the ordering is the same as the insertion ordering. This class is used by Mobius to emit join key.

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
 
Nested classes/interfaces inherited from class com.ebay.erl.mobius.core.model.Tuple
Tuple.TupleColumnName
 
Field Summary
 
Fields inherited from class com.ebay.erl.mobius.core.model.Tuple
_INSERT_KEY, BOOLEAN_TYPE, BYTE_ARRAY_TYPE, BYTE_TYPE, conf, DATE_TYPE, DOUBLE_TYPE, estimate_size_in_bytes, FLOAT_TYPE, INTEGER_TYPE, isMutable, LONG_TYPE, lowerCases, namesToIdxMapping, NULL, NULL_TYPE, NULL_WRITABLE_TYPE, RESULT_WRAPPER_TYPE, SERIALIZABLE_TYPE, SHORT_TYPE, sortedKeys, STRING_MAP_TYPE, STRING_TYPE, TIME_TYPE, TIMESTAMP_TYPE, toStringOrdering, TUPLE_TYPE, values, WRITABLE_TYPE
 
Constructor Summary
KeyTuple()
           
 
Method Summary
 void setSchema(java.lang.String[] schema)
          To set the schema of this tuple.
 void write(java.io.DataOutput out)
          Serialize this tuple to the output out.
 
Methods inherited from class com.ebay.erl.mobius.core.model.Tuple
check_in_schema, clone, compare, compare, compareTo, equals, get, get, get, get, getBoolean, getBoolean, getByte, getByte, getConf, getDate, getDate, getDouble, getDouble, getDouble, getEstimatedSizeInMemory, getFloat, getFloat, getInt, getInt, getLong, getLong, getMap, getSchema, getShort, getShort, getSorted, getString, getString, getTime, getTime, getTimestamp, getTimestamp, getType, getTypeString, hashCode, hasSchema, immutable, insert, isDateType, isNumericalType, lowerCase, main, merge, put, put, put, put, put, put, put, put, put, put, put, put, put, put, put, put, putNull, readFields, setConf, setToStringOrdering, toString, valueOf
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

KeyTuple

public KeyTuple()
Method Detail

setSchema

public void setSchema(java.lang.String[] schema)
Description copied from class: Tuple
To set the schema of this tuple.

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.

Overrides:
setSchema in class Tuple

write

public void write(java.io.DataOutput out)
           throws java.io.IOException
Description copied from class: Tuple
Serialize this tuple to the output out.

When serialize, the values are stored in the order of schema name's ordering. See Tuple.setSchema(String[]) for more explanation.

Specified by:
write in interface org.apache.hadoop.io.Writable
Overrides:
write in class Tuple
Throws:
java.io.IOException