public class AvroTypeInfo<T extends org.apache.avro.specific.SpecificRecordBase> extends PojoTypeInfo<T>
Proceeding: It uses a regular pojo type analysis and replaces all GenericType<CharSequence>
with a GenericType<avro.Utf8>
.
All other types used by Avro are standard Java types.
Only strings are represented as CharSequence fields and represented as Utf8 classes at runtime.
CharSequence is not comparable. To make them nicely usable with field expressions, we replace them here
by generic type infos containing Utf8 classes (which are comparable),
This class is checked by the AvroPojoTest.
PojoTypeInfo.NamedFlatFieldDescriptor
CompositeType.FlatFieldDescriptor, CompositeType.InvalidFieldReferenceException, CompositeType.TypeComparatorBuilder<T>
Constructor and Description |
---|
AvroTypeInfo(Class<T> typeClass)
Creates a new Avro type info for the given class.
|
AvroTypeInfo(Class<T> typeClass,
boolean useBackwardsCompatibleSerializer)
Creates a new Avro type info for the given class.
|
Modifier and Type | Method and Description |
---|---|
TypeSerializer<T> |
createSerializer(ExecutionConfig config)
Creates a serializer for the type.
|
static <T extends org.apache.avro.specific.SpecificRecordBase> |
generateFieldsFromAvroSchema(Class<T> typeClass,
boolean useBackwardsCompatibleSerializer) |
canEqual, createPojoSerializer, createTypeComparatorBuilder, equals, getArity, getFieldIndex, getFieldNames, getFlatFields, getPojoFieldAt, getTotalFields, getTypeAt, getTypeAt, hashCode, isBasicType, isSortKeyType, isTupleType, toString
createComparator, getFlatFields, getTypeClass, hasDeterministicFieldOrder, hasField, isKeyType
getGenericParameters, of, of
public AvroTypeInfo(Class<T> typeClass)
public AvroTypeInfo(Class<T> typeClass, boolean useBackwardsCompatibleSerializer)
This constructor takes a flag to specify whether a serializer that is backwards compatible with PoJo-style serialization of Avro types should be used. That is only necessary, if one has a Flink 1.3 (or earlier) savepoint where Avro types were stored in the checkpointed state. New Flink programs will never need this.
public TypeSerializer<T> createSerializer(ExecutionConfig config)
TypeInformation
createSerializer
in class PojoTypeInfo<T extends org.apache.avro.specific.SpecificRecordBase>
config
- The config used to parameterize the serializer.Copyright © 2014–2018 The Apache Software Foundation. All rights reserved.