com.cloudera.crunch.impl.mem.collect
Class MemTable<K,V>

java.lang.Object
  extended by com.cloudera.crunch.impl.mem.collect.MemCollection<Pair<K,V>>
      extended by com.cloudera.crunch.impl.mem.collect.MemTable<K,V>
All Implemented Interfaces:
PCollection<Pair<K,V>>, PTable<K,V>

public class MemTable<K,V>
extends MemCollection<Pair<K,V>>
implements PTable<K,V>


Constructor Summary
MemTable(Iterable<Pair<K,V>> collect)
           
MemTable(Iterable<Pair<K,V>> collect, PTableType<K,V> ptype, String name)
           
 
Method Summary
 PTable<K,V> bottom(int count)
          Returns a PTable made up of the pairs in this PTable with the smallest value field.
<U> PTable<K,Pair<Collection<V>,Collection<U>>>
cogroup(PTable<K,U> other)
          Co-group operation with the given table on common keys.
 PTable<K,Collection<V>> collectValues()
          Aggregate all of the values with the same key into a single key-value pair in the returned PTable.
 PType<K> getKeyType()
          Returns the PType of the key.
 PTableType<K,V> getPTableType()
          Returns the PTableType of this PTable.
 PType<V> getValueType()
          Returns the PType of the value.
 PGroupedTable<K,V> groupByKey()
          Performs a grouping operation on the keys of this table.
 PGroupedTable<K,V> groupByKey(GroupingOptions options)
          Performs a grouping operation on the keys of this table, using the additional GroupingOptions to control how the grouping is executed.
 PGroupedTable<K,V> groupByKey(int numPartitions)
          Performs a grouping operation on the keys of this table, using the given number of partitions.
<U> PTable<K,Pair<V,U>>
join(PTable<K,U> other)
          Perform an inner join on this table and the one passed in as an argument on their common keys.
 PTable<K,V> top(int count)
          Returns a PTable made up of the pairs in this PTable with the largest value field.
 PTable<K,V> union(PTable<K,V>... others)
          Returns a PTable instance that acts as the union of this PTable and the input PTables.
 PTable<K,V> write(Target target)
          Write the contents of this PCollection to the given Target, using the storage format specified by the target.
 
Methods inherited from class com.cloudera.crunch.impl.mem.collect.MemCollection
count, filter, getCollection, getName, getPipeline, getPType, getSize, getTypeFamily, materialize, max, min, parallelDo, parallelDo, parallelDo, parallelDo, sample, sample, sort, toString, union
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface com.cloudera.crunch.PCollection
count, filter, getName, getPipeline, getPType, getSize, getTypeFamily, materialize, max, min, parallelDo, parallelDo, parallelDo, parallelDo, sample, sample, sort, union
 

Constructor Detail

MemTable

public MemTable(Iterable<Pair<K,V>> collect)

MemTable

public MemTable(Iterable<Pair<K,V>> collect,
                PTableType<K,V> ptype,
                String name)
Method Detail

union

public PTable<K,V> union(PTable<K,V>... others)
Description copied from interface: PTable
Returns a PTable instance that acts as the union of this PTable and the input PTables.

Specified by:
union in interface PTable<K,V>

groupByKey

public PGroupedTable<K,V> groupByKey()
Description copied from interface: PTable
Performs a grouping operation on the keys of this table.

Specified by:
groupByKey in interface PTable<K,V>
Returns:
a PGroupedTable instance that represents the grouping

groupByKey

public PGroupedTable<K,V> groupByKey(int numPartitions)
Description copied from interface: PTable
Performs a grouping operation on the keys of this table, using the given number of partitions.

Specified by:
groupByKey in interface PTable<K,V>
Parameters:
numPartitions - The number of partitions for the data.
Returns:
a PGroupedTable instance that represents this grouping

groupByKey

public PGroupedTable<K,V> groupByKey(GroupingOptions options)
Description copied from interface: PTable
Performs a grouping operation on the keys of this table, using the additional GroupingOptions to control how the grouping is executed.

Specified by:
groupByKey in interface PTable<K,V>
Parameters:
options - The grouping options to use
Returns:
a PGroupedTable instance that represents the grouping

write

public PTable<K,V> write(Target target)
Description copied from interface: PCollection
Write the contents of this PCollection to the given Target, using the storage format specified by the target.

Specified by:
write in interface PCollection<Pair<K,V>>
Specified by:
write in interface PTable<K,V>
Overrides:
write in class MemCollection<Pair<K,V>>
Parameters:
target - The target to write to

getPTableType

public PTableType<K,V> getPTableType()
Description copied from interface: PTable
Returns the PTableType of this PTable.

Specified by:
getPTableType in interface PTable<K,V>

getKeyType

public PType<K> getKeyType()
Description copied from interface: PTable
Returns the PType of the key.

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

getValueType

public PType<V> getValueType()
Description copied from interface: PTable
Returns the PType of the value.

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

top

public PTable<K,V> top(int count)
Description copied from interface: PTable
Returns a PTable made up of the pairs in this PTable with the largest value field.

Specified by:
top in interface PTable<K,V>
Parameters:
count - The number of pairs to return

bottom

public PTable<K,V> bottom(int count)
Description copied from interface: PTable
Returns a PTable made up of the pairs in this PTable with the smallest value field.

Specified by:
bottom in interface PTable<K,V>
Parameters:
count - The number of pairs to return

collectValues

public PTable<K,Collection<V>> collectValues()
Description copied from interface: PTable
Aggregate all of the values with the same key into a single key-value pair in the returned PTable.

Specified by:
collectValues in interface PTable<K,V>

join

public <U> PTable<K,Pair<V,U>> join(PTable<K,U> other)
Description copied from interface: PTable
Perform an inner join on this table and the one passed in as an argument on their common keys.

Specified by:
join in interface PTable<K,V>

cogroup

public <U> PTable<K,Pair<Collection<V>,Collection<U>>> cogroup(PTable<K,U> other)
Description copied from interface: PTable
Co-group operation with the given table on common keys.

Specified by:
cogroup in interface PTable<K,V>


Copyright © 2012. All Rights Reserved.