public class Writables extends Object
WritableTypeFamily for convenient static importing.| Modifier and Type | Method and Description |
|---|---|
static WritableType<Boolean,org.apache.hadoop.io.BooleanWritable> |
booleans() |
static WritableType<ByteBuffer,org.apache.hadoop.io.BytesWritable> |
bytes() |
static <T> WritableType<Collection<T>,org.apache.crunch.types.writable.GenericArrayWritable> |
collections(PType<T> ptype) |
static <S,T> PType<T> |
derived(Class<T> clazz,
MapFn<S,T> inputFn,
MapFn<T,S> outputFn,
PType<S> base) |
static <S,T> PType<T> |
derivedImmutable(Class<T> clazz,
MapFn<S,T> inputFn,
MapFn<T,S> outputFn,
PType<S> base) |
static WritableType<Double,org.apache.hadoop.io.DoubleWritable> |
doubles() |
static WritableType<Float,org.apache.hadoop.io.FloatWritable> |
floats() |
static <T> PType<T> |
getPrimitiveType(Class<T> clazz) |
static WritableType<Integer,org.apache.hadoop.io.IntWritable> |
ints() |
static <T> PType<T> |
jsons(Class<T> clazz) |
static WritableType<Long,org.apache.hadoop.io.LongWritable> |
longs() |
static <T> WritableType<Map<String,T>,org.apache.hadoop.io.MapWritable> |
maps(PType<T> ptype) |
static WritableType<Void,org.apache.hadoop.io.NullWritable> |
nulls() |
static <V1,V2> WritableType<Pair<V1,V2>,TupleWritable> |
pairs(PType<V1> p1,
PType<V2> p2) |
static <V1,V2,V3,V4> |
quads(PType<V1> p1,
PType<V2> p2,
PType<V3> p3,
PType<V4> p4) |
static <T,W extends org.apache.hadoop.io.Writable> |
records(Class<T> clazz) |
static <T> void |
register(Class<T> clazz,
WritableType<T,? extends org.apache.hadoop.io.Writable> ptype) |
static void |
registerComparable(Class<? extends org.apache.hadoop.io.WritableComparable> clazz)
Registers a
WritableComparable class so that it can be used for comparing the fields inside of
tuple types (e.g., pairs, trips, tupleN, etc.) for use in sorts and
secondary sorts. |
static void |
registerComparable(Class<? extends org.apache.hadoop.io.WritableComparable> clazz,
int code)
Registers a
WritableComparable class with a given integer code to use for serializing
and deserializing instances of this class that are defined inside of tuple types (e.g., pairs,
trips, tupleN, etc.) Unregistered Writables are always serialized to bytes and
cannot be used in comparisons (e.g., sorts and secondary sorts) according to their underlying types. |
static WritableType<String,org.apache.hadoop.io.Text> |
strings() |
static <K,V> org.apache.crunch.types.writable.WritableTableType<K,V> |
tableOf(PType<K> key,
PType<V> value) |
static <V1,V2,V3> WritableType<Tuple3<V1,V2,V3>,TupleWritable> |
triples(PType<V1> p1,
PType<V2> p2,
PType<V3> p3) |
static <T extends Tuple> |
tuples(Class<T> clazz,
PType... ptypes) |
static WritableType<TupleN,TupleWritable> |
tuples(PType... ptypes) |
static PType<Union> |
unionOf(PType<?>... ptypes) |
static <W extends org.apache.hadoop.io.Writable> |
writables(Class<W> clazz) |
public static void registerComparable(Class<? extends org.apache.hadoop.io.WritableComparable> clazz)
WritableComparable class so that it can be used for comparing the fields inside of
tuple types (e.g., pairs, trips, tupleN, etc.) for use in sorts and
secondary sorts.clazz - The WritableComparable class to registerpublic static void registerComparable(Class<? extends org.apache.hadoop.io.WritableComparable> clazz, int code)
WritableComparable class with a given integer code to use for serializing
and deserializing instances of this class that are defined inside of tuple types (e.g., pairs,
trips, tupleN, etc.) Unregistered Writables are always serialized to bytes and
cannot be used in comparisons (e.g., sorts and secondary sorts) according to their underlying types.clazz - The class to registercode - The unique registration code for the class, which must be greater than or equal to 8public static <T> void register(Class<T> clazz, WritableType<T,? extends org.apache.hadoop.io.Writable> ptype)
public static final WritableType<Void,org.apache.hadoop.io.NullWritable> nulls()
public static final WritableType<String,org.apache.hadoop.io.Text> strings()
public static final WritableType<Long,org.apache.hadoop.io.LongWritable> longs()
public static final WritableType<Integer,org.apache.hadoop.io.IntWritable> ints()
public static final WritableType<Float,org.apache.hadoop.io.FloatWritable> floats()
public static final WritableType<Double,org.apache.hadoop.io.DoubleWritable> doubles()
public static final WritableType<Boolean,org.apache.hadoop.io.BooleanWritable> booleans()
public static final WritableType<ByteBuffer,org.apache.hadoop.io.BytesWritable> bytes()
public static final <T,W extends org.apache.hadoop.io.Writable> WritableType<T,W> records(Class<T> clazz)
public static <W extends org.apache.hadoop.io.Writable> WritableType<W,W> writables(Class<W> clazz)
public static <K,V> org.apache.crunch.types.writable.WritableTableType<K,V> tableOf(PType<K> key, PType<V> value)
public static <V1,V2> WritableType<Pair<V1,V2>,TupleWritable> pairs(PType<V1> p1, PType<V2> p2)
public static <V1,V2,V3> WritableType<Tuple3<V1,V2,V3>,TupleWritable> triples(PType<V1> p1, PType<V2> p2, PType<V3> p3)
public static <V1,V2,V3,V4> WritableType<Tuple4<V1,V2,V3,V4>,TupleWritable> quads(PType<V1> p1, PType<V2> p2, PType<V3> p3, PType<V4> p4)
public static WritableType<TupleN,TupleWritable> tuples(PType... ptypes)
public static <S,T> PType<T> derived(Class<T> clazz, MapFn<S,T> inputFn, MapFn<T,S> outputFn, PType<S> base)
public static <S,T> PType<T> derivedImmutable(Class<T> clazz, MapFn<S,T> inputFn, MapFn<T,S> outputFn, PType<S> base)
public static <T> WritableType<Collection<T>,org.apache.crunch.types.writable.GenericArrayWritable> collections(PType<T> ptype)
public static <T> WritableType<Map<String,T>,org.apache.hadoop.io.MapWritable> maps(PType<T> ptype)
Copyright © 2016 The Apache Software Foundation. All rights reserved.