public class AvroType<T> extends Object implements PType<T>
| Modifier and Type | Class and Description |
|---|---|
static class |
AvroType.AvroRecordType |
| Constructor and Description |
|---|
AvroType(Class<T> typeClass,
org.apache.avro.Schema schema,
DeepCopier<T> deepCopier,
PType... ptypes) |
AvroType(Class<T> typeClass,
org.apache.avro.Schema schema,
MapFn inputMapFn,
MapFn outputMapFn,
DeepCopier<T> deepCopier,
AvroType.AvroRecordType recordType,
PType... ptypes) |
| Modifier and Type | Method and Description |
|---|---|
ReadableSource<T> |
createSourceTarget(org.apache.hadoop.conf.Configuration conf,
org.apache.hadoop.fs.Path path,
Iterable<T> contents,
int parallelism)
Returns a
ReadableSource that contains the data in the given Iterable. |
boolean |
equals(Object other) |
Converter |
getConverter() |
ReadableSourceTarget<T> |
getDefaultFileSource(org.apache.hadoop.fs.Path path)
Returns a
SourceTarget that is able to read/write data using the serialization format
specified by this PType. |
T |
getDetachedValue(T value)
Returns a copy of a value (or the value itself) that can safely be retained.
|
PTypeFamily |
getFamily()
Returns the
PTypeFamily that this PType belongs to. |
MapFn<Object,T> |
getInputMapFn() |
MapFn<T,Object> |
getOutputMapFn() |
AvroType.AvroRecordType |
getRecordType() |
org.apache.avro.Schema |
getSchema() |
List<PType> |
getSubTypes()
Returns the sub-types that make up this PType if it is a composite instance, such as a tuple.
|
Class<T> |
getTypeClass()
Returns the Java type represented by this
PType. |
int |
hashCode() |
boolean |
hasReflect()
Determine if the wrapped type is a reflection-based avro type or wraps one.
|
boolean |
hasSpecific()
Determine if the wrapped type is a specific data avro type or wraps one.
|
void |
initialize(org.apache.hadoop.conf.Configuration conf)
Initialize this PType for use within a DoFn.
|
boolean |
isGeneric()
Determine if the wrapped type is a generic data avro type.
|
public AvroType(Class<T> typeClass, org.apache.avro.Schema schema, DeepCopier<T> deepCopier, PType... ptypes)
public AvroType(Class<T> typeClass, org.apache.avro.Schema schema, MapFn inputMapFn, MapFn outputMapFn, DeepCopier<T> deepCopier, AvroType.AvroRecordType recordType, PType... ptypes)
public AvroType.AvroRecordType getRecordType()
public Class<T> getTypeClass()
PTypePType.getTypeClass in interface PType<T>public PTypeFamily getFamily()
PTypePTypeFamily that this PType belongs to.public List<PType> getSubTypes()
PTypegetSubTypes in interface PType<T>public org.apache.avro.Schema getSchema()
public boolean hasSpecific()
public boolean isGeneric()
public boolean hasReflect()
public MapFn<Object,T> getInputMapFn()
getInputMapFn in interface PType<T>public MapFn<T,Object> getOutputMapFn()
getOutputMapFn in interface PType<T>public Converter getConverter()
getConverter in interface PType<T>public ReadableSourceTarget<T> getDefaultFileSource(org.apache.hadoop.fs.Path path)
PTypeSourceTarget that is able to read/write data using the serialization format
specified by this PType.getDefaultFileSource in interface PType<T>public ReadableSource<T> createSourceTarget(org.apache.hadoop.conf.Configuration conf, org.apache.hadoop.fs.Path path, Iterable<T> contents, int parallelism) throws IOException
PTypeReadableSource that contains the data in the given Iterable.createSourceTarget in interface PType<T>conf - The Configuration to usepath - The path to write the data tocontents - The contents to writeparallelism - The desired parallelismIOExceptionpublic void initialize(org.apache.hadoop.conf.Configuration conf)
PTypePType.getDetachedValue(Object).initialize in interface PType<T>conf - Configuration objectPType.getDetachedValue(Object)public T getDetachedValue(T value)
PType
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.
getDetachedValue in interface PType<T>value - The value to be deep-copiedCopyright © 2017 The Apache Software Foundation. All rights reserved.