public class Avros extends Object
AvroTypeFamily
for convenient static importing.Modifier and Type | Field and Description |
---|---|
static MapFn<Object,ByteBuffer> |
BYTES_IN |
static boolean |
CAN_COMBINE_SPECIFIC_AND_REFLECT_SCHEMAS
Older versions of Avro (i.e., before 1.7.0) do not support schemas that are
composed of a mix of specific and reflection-based schemas.
|
static ReflectDataFactory |
REFLECT_DATA_FACTORY
Deprecated.
as of 0.9.0; use AvroMode.REFLECT.override(ReaderWriterFactory)
|
static String |
REFLECT_DATA_FACTORY_CLASS
The name of the configuration parameter that tracks which reflection
factory to use.
|
static MapFn<String,org.apache.avro.util.Utf8> |
STRING_TO_UTF8 |
static MapFn<CharSequence,String> |
UTF8_TO_STRING |
Modifier and Type | Method and Description |
---|---|
static AvroType<Boolean> |
booleans() |
static AvroType<ByteBuffer> |
bytes() |
static void |
checkCombiningSpecificAndReflectionSchemas() |
static <T> AvroType<Collection<T>> |
collections(PType<T> ptype) |
static void |
configureReflectDataFactory(org.apache.hadoop.conf.Configuration conf)
Deprecated.
as of 0.9.0; use AvroMode.REFLECT.configure(Configuration)
|
static <T> AvroType<T> |
containers(Class<T> clazz) |
static <S,T> AvroType<T> |
derived(Class<T> clazz,
MapFn<S,T> inputFn,
MapFn<T,S> outputFn,
PType<S> base) |
static <S,T> AvroType<T> |
derivedImmutable(Class<T> clazz,
MapFn<S,T> inputFn,
MapFn<T,S> outputFn,
PType<S> base) |
static AvroType<Double> |
doubles() |
static AvroType<Float> |
floats() |
static AvroType<org.apache.avro.generic.GenericData.Record> |
generics(org.apache.avro.Schema schema) |
static <T> PType<T> |
getPrimitiveType(Class<T> clazz) |
static ReflectDataFactory |
getReflectDataFactory(org.apache.hadoop.conf.Configuration conf)
Deprecated.
as of 0.9.0; use AvroMode.fromConfiguration(conf)
|
static AvroType<Integer> |
ints() |
static <T> PType<T> |
jsons(Class<T> clazz) |
static <K,V> org.apache.crunch.types.avro.AvroKeyValueTableType<K,V> |
keyValueTableOf(PType<K> key,
PType<V> value)
A table type with an Avro type as key and value.
|
static AvroType<Long> |
longs() |
static <T> AvroType<Map<String,T>> |
maps(PType<T> ptype) |
static AvroType<TupleN> |
namedTuples(String tupleName,
String[] fieldNames,
PType[] ptypes) |
static <T> org.apache.avro.io.DatumReader<T> |
newReader(AvroType<T> type) |
static <T> org.apache.avro.io.DatumReader<T> |
newReader(org.apache.avro.Schema schema) |
static <T> org.apache.avro.io.DatumWriter<T> |
newWriter(AvroType<T> type) |
static <T> org.apache.avro.io.DatumWriter<T> |
newWriter(org.apache.avro.Schema schema) |
static AvroType<Void> |
nulls() |
static <V1,V2> AvroType<Pair<V1,V2>> |
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> AvroType<T> |
records(Class<T> clazz) |
static <T> AvroType<T> |
reflects(Class<T> clazz) |
static <T> AvroType<T> |
reflects(Class<T> clazz,
org.apache.avro.Schema schema) |
static <T> void |
register(Class<T> clazz,
AvroType<T> ptype) |
static <T extends org.apache.avro.specific.SpecificRecord> |
specifics(Class<T> clazz) |
static AvroType<String> |
strings() |
static <K,V> org.apache.crunch.types.avro.AvroTableType<K,V> |
tableOf(PType<K> key,
PType<V> value)
A table type with an Avro type as key and as value.
|
static <V1,V2,V3> AvroType<Tuple3<V1,V2,V3>> |
triples(PType<V1> p1,
PType<V2> p2,
PType<V3> p3) |
static <T extends Tuple> |
tuples(Class<T> clazz,
PType... ptypes) |
static AvroType<TupleN> |
tuples(PType... ptypes) |
static PType<Union> |
unionOf(PType<?>... ptypes) |
static <T extends org.apache.hadoop.io.Writable> |
writables(Class<T> clazz) |
public static final boolean CAN_COMBINE_SPECIFIC_AND_REFLECT_SCHEMAS
public static ReflectDataFactory REFLECT_DATA_FACTORY
AvroMode.override(ReaderWriterFactory)
.public static final String REFLECT_DATA_FACTORY_CLASS
public static MapFn<CharSequence,String> UTF8_TO_STRING
public static MapFn<Object,ByteBuffer> BYTES_IN
@Deprecated public static void configureReflectDataFactory(org.apache.hadoop.conf.Configuration conf)
public static ReflectDataFactory getReflectDataFactory(org.apache.hadoop.conf.Configuration conf)
public static void checkCombiningSpecificAndReflectionSchemas()
public static <T> org.apache.avro.io.DatumReader<T> newReader(org.apache.avro.Schema schema)
public static <T> org.apache.avro.io.DatumReader<T> newReader(AvroType<T> type)
public static <T> org.apache.avro.io.DatumWriter<T> newWriter(org.apache.avro.Schema schema)
public static <T> org.apache.avro.io.DatumWriter<T> newWriter(AvroType<T> type)
public static final AvroType<ByteBuffer> bytes()
public static final AvroType<org.apache.avro.generic.GenericData.Record> generics(org.apache.avro.Schema schema)
public static final <T extends org.apache.avro.specific.SpecificRecord> AvroType<T> specifics(Class<T> clazz)
public static final <T> AvroType<T> reflects(Class<T> clazz, org.apache.avro.Schema schema)
public static final <T extends org.apache.hadoop.io.Writable> AvroType<T> writables(Class<T> clazz)
public static final <T> AvroType<Collection<T>> collections(PType<T> ptype)
public static final <V1,V2,V3> AvroType<Tuple3<V1,V2,V3>> triples(PType<V1> p1, PType<V2> p2, PType<V3> p3)
public static final <V1,V2,V3,V4> AvroType<Tuple4<V1,V2,V3,V4>> quads(PType<V1> p1, PType<V2> p2, PType<V3> p3, PType<V4> p4)
public static final AvroType<TupleN> namedTuples(String tupleName, String[] fieldNames, PType[] ptypes)
public static final <S,T> AvroType<T> derived(Class<T> clazz, MapFn<S,T> inputFn, MapFn<T,S> outputFn, PType<S> base)
public static final <S,T> AvroType<T> derivedImmutable(Class<T> clazz, MapFn<S,T> inputFn, MapFn<T,S> outputFn, PType<S> base)
public static final <K,V> org.apache.crunch.types.avro.AvroTableType<K,V> tableOf(PType<K> key, PType<V> value)
Pair
s that
are created using the org.apache.avro.mapred.AvroJob
class.key
- the PType of the key in the tablevalue
- the PType of the value in the tablepublic static final <K,V> org.apache.crunch.types.avro.AvroKeyValueTableType<K,V> keyValueTableOf(PType<K> key, PType<V> value)
PTableType
returned by this method is specifically
for reading and writing files that are compatible with those created via the
org.apache.avro.mapreduce.AvroJob
class. For all other Avro table purposes, the
tableOf(org.apache.crunch.types.PType, org.apache.crunch.types.PType)
method should be used.key
- the PType of the key in the tablevalue
- the PType of the value in the tableorg.apache.avro.mapreduce.AvroJob
classCopyright © 2017 The Apache Software Foundation. All rights reserved.