public class PTables extends Object
| Constructor and Description |
|---|
PTables() |
| Modifier and Type | Method and Description |
|---|---|
static <K,V> PTable<K,V> |
asPTable(PCollection<Pair<K,V>> pcollect)
Convert the given
PCollection<Pair<K, V>> to a PTable<K, V>. |
static <K,V> Pair<K,V> |
getDetachedValue(PTableType<K,V> tableType,
Pair<K,V> value)
Create a detached value for a table
Pair. |
static <K,V> Pair<K,Iterable<V>> |
getGroupedDetachedValue(PGroupedTableType<K,V> groupedTableType,
Pair<K,Iterable<V>> value)
Created a detached value for a
PGroupedTable value. |
static <K,V> PCollection<K> |
keys(PTable<K,V> ptable)
Extract the keys from the given
PTable<K, V> as a PCollection<K>. |
static <K1,K2,V> PTable<K2,V> |
mapKeys(PTable<K1,V> ptable,
MapFn<K1,K2> mapFn,
PType<K2> ptype)
Maps a
PTable<K1, V> to a PTable<K2, V> using the given MapFn<K1, K2> on
the keys of the PTable. |
static <K1,K2,V> PTable<K2,V> |
mapKeys(String name,
PTable<K1,V> ptable,
MapFn<K1,K2> mapFn,
PType<K2> ptype)
Maps a
PTable<K1, V> to a PTable<K2, V> using the given MapFn<K1, K2> on
the keys of the PTable. |
static <K,U,V> PTable<K,V> |
mapValues(PGroupedTable<K,U> ptable,
MapFn<Iterable<U>,V> mapFn,
PType<V> ptype)
An analogue of the
mapValues function for PGroupedTable<K, U> collections. |
static <K,U,V> PTable<K,V> |
mapValues(PTable<K,U> ptable,
MapFn<U,V> mapFn,
PType<V> ptype)
Maps a
PTable<K, U> to a PTable<K, V> using the given MapFn<U, V> on
the values of the PTable. |
static <K,U,V> PTable<K,V> |
mapValues(String name,
PGroupedTable<K,U> ptable,
MapFn<Iterable<U>,V> mapFn,
PType<V> ptype)
An analogue of the
mapValues function for PGroupedTable<K, U> collections. |
static <K,U,V> PTable<K,V> |
mapValues(String name,
PTable<K,U> ptable,
MapFn<U,V> mapFn,
PType<V> ptype)
Maps a
PTable<K, U> to a PTable<K, V> using the given MapFn<U, V> on
the values of the PTable. |
static <K,V> PTable<V,K> |
swapKeyValue(PTable<K,V> table)
Swap the key and value part of a table.
|
static <K,V> PCollection<V> |
values(PTable<K,V> ptable)
Extract the values from the given
PTable<K, V> as a PCollection<V>. |
public static <K,V> PTable<K,V> asPTable(PCollection<Pair<K,V>> pcollect)
PCollection<Pair<K, V>> to a PTable<K, V>.pcollect - The PCollection to convertPTable that contains the same data as the input PCollectionpublic static <K1,K2,V> PTable<K2,V> mapKeys(PTable<K1,V> ptable, MapFn<K1,K2> mapFn, PType<K2> ptype)
PTable<K1, V> to a PTable<K2, V> using the given MapFn<K1, K2> on
the keys of the PTable.ptable - The PTable to be mappedmapFn - The mapping functionptype - The PType for the returned keysPTable<K2, V> instancepublic static <K1,K2,V> PTable<K2,V> mapKeys(String name, PTable<K1,V> ptable, MapFn<K1,K2> mapFn, PType<K2> ptype)
PTable<K1, V> to a PTable<K2, V> using the given MapFn<K1, K2> on
the keys of the PTable.name - The name of the transformptable - The PTable to be mappedmapFn - The mapping functionptype - The PType for the returned keysPTable<K2, V> instancepublic static <K,U,V> PTable<K,V> mapValues(PTable<K,U> ptable, MapFn<U,V> mapFn, PType<V> ptype)
PTable<K, U> to a PTable<K, V> using the given MapFn<U, V> on
the values of the PTable.ptable - The PTable to be mappedmapFn - The mapping functionptype - The PType for the returned valuesPTable<K, V> instancepublic static <K,U,V> PTable<K,V> mapValues(String name, PTable<K,U> ptable, MapFn<U,V> mapFn, PType<V> ptype)
PTable<K, U> to a PTable<K, V> using the given MapFn<U, V> on
the values of the PTable.name - The name of the transformptable - The PTable to be mappedmapFn - The mapping functionptype - The PType for the returned valuesPTable<K, V> instancepublic static <K,U,V> PTable<K,V> mapValues(PGroupedTable<K,U> ptable, MapFn<Iterable<U>,V> mapFn, PType<V> ptype)
mapValues function for PGroupedTable<K, U> collections.ptable - The PGroupedTable to be mappedmapFn - The mapping functionptype - The PType for the returned valuesPTable<K, V> instancepublic static <K,U,V> PTable<K,V> mapValues(String name, PGroupedTable<K,U> ptable, MapFn<Iterable<U>,V> mapFn, PType<V> ptype)
mapValues function for PGroupedTable<K, U> collections.name - The name of the operationptable - The PGroupedTable to be mappedmapFn - The mapping functionptype - The PType for the returned valuesPTable<K, V> instancepublic static <K,V> PCollection<K> keys(PTable<K,V> ptable)
PTable<K, V> as a PCollection<K>.ptable - The PTablePCollection<K>public static <K,V> PCollection<V> values(PTable<K,V> ptable)
PTable<K, V> as a PCollection<V>.ptable - The PTablePCollection<V>public static <K,V> Pair<K,V> getDetachedValue(PTableType<K,V> tableType, Pair<K,V> value)
Pair.tableType - The table typevalue - The value from which a detached value is to be createdPType.getDetachedValue(Object)public static <K,V> Pair<K,Iterable<V>> getGroupedDetachedValue(PGroupedTableType<K,V> groupedTableType, Pair<K,Iterable<V>> value)
PGroupedTable value.groupedTableType - The grouped table typevalue - The value from which a detached value is to be createdPType.getDetachedValue(Object)public static <K,V> PTable<V,K> swapKeyValue(PTable<K,V> table)
K - Key type (will become value type)V - Value type (will become key type)table - PTable to processCopyright © 2015 The Apache Software Foundation. All Rights Reserved.