This project has retired. For details please refer to its Attic page.
AvroTableType (Apache Crunch 0.4.0-incubating API)

org.apache.crunch.types.avro
Class AvroTableType<K,V>

java.lang.Object
  extended by org.apache.crunch.types.avro.AvroType<Pair<K,V>>
      extended by org.apache.crunch.types.avro.AvroTableType<K,V>
All Implemented Interfaces:
Serializable, PTableType<K,V>, PType<Pair<K,V>>

public class AvroTableType<K,V>
extends AvroType<Pair<K,V>>
implements PTableType<K,V>

The implementation of the PTableType interface for Avro-based serialization.

See Also:
Serialized Form

Constructor Summary
AvroTableType(AvroType<K> keyType, AvroType<V> valueType, Class<Pair<K,V>> pairClass)
           
 
Method Summary
 Pair<K,V> getDetachedValue(Pair<K,V> value)
          Returns a copy of a value (or the value itself) that can safely be retained.
 PGroupedTableType<K,V> getGroupedTableType()
          Returns the grouped table version of this type.
 PType<K> getKeyType()
          Returns the key type for the table.
 PType<V> getValueType()
          Returns the value type for the table.
 
Methods inherited from class org.apache.crunch.types.avro.AvroType
equals, getConverter, getDefaultFileSource, getFamily, getInputMapFn, getOutputMapFn, getSchema, getSubTypes, getTypeClass, hashCode, hasReflect, hasSpecific, initialize, isGeneric
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.apache.crunch.types.PType
getConverter, getDefaultFileSource, getFamily, getInputMapFn, getOutputMapFn, getSubTypes, getTypeClass, initialize
 

Constructor Detail

AvroTableType

public AvroTableType(AvroType<K> keyType,
                     AvroType<V> valueType,
                     Class<Pair<K,V>> pairClass)
Method Detail

getKeyType

public PType<K> getKeyType()
Description copied from interface: PTableType
Returns the key type for the table.

Specified by:
getKeyType in interface PTableType<K,V>

getValueType

public PType<V> getValueType()
Description copied from interface: PTableType
Returns the value type for the table.

Specified by:
getValueType in interface PTableType<K,V>

getGroupedTableType

public PGroupedTableType<K,V> getGroupedTableType()
Description copied from interface: PTableType
Returns the grouped table version of this type.

Specified by:
getGroupedTableType in interface PTableType<K,V>

getDetachedValue

public Pair<K,V> getDetachedValue(Pair<K,V> value)
Description copied from interface: PType
Returns a copy of a value (or the value itself) that can safely be retained.

This is useful when iterable values being processed in a DoFn (via a reducer) need to be held on to for more than the scope of a single iteration, as a reducer (and therefore also a DoFn that has an Iterable as input) re-use deserialized values. More information on object reuse is available in the DoFn class documentation.

Specified by:
getDetachedValue in interface PType<Pair<K,V>>
Overrides:
getDetachedValue in class AvroType<Pair<K,V>>
Parameters:
value - The value to be deep-copied
Returns:
A deep copy of the input value


Copyright © 2012 The Apache Software Foundation. All Rights Reserved.