Class RowTypeInfo
- java.lang.Object
-
- org.apache.flink.api.common.typeinfo.TypeInformation<T>
-
- org.apache.flink.api.common.typeutils.CompositeType<T>
-
- org.apache.flink.api.java.typeutils.TupleTypeInfoBase<Row>
-
- org.apache.flink.api.java.typeutils.RowTypeInfo
-
- All Implemented Interfaces:
Serializable
@PublicEvolving public class RowTypeInfo extends TupleTypeInfoBase<Row>
TypeInformationforRow.Note: The implementations of
hashCode()andequals(Object)do not check field names because those don't matter during serialization and runtime. This might change in future versions. See FLINK-14438 for more information.- See Also:
- Serialized Form
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.apache.flink.api.common.typeutils.CompositeType
CompositeType.FlatFieldDescriptor, CompositeType.InvalidFieldReferenceException, CompositeType.TypeComparatorBuilder<T>
-
-
Field Summary
Fields Modifier and Type Field Description protected String[]fieldNames-
Fields inherited from class org.apache.flink.api.java.typeutils.TupleTypeInfoBase
types
-
-
Constructor Summary
Constructors Constructor Description RowTypeInfo(TypeInformation<?>... types)RowTypeInfo(TypeInformation<?>[] types, String[] fieldNames)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description booleancanEqual(Object obj)Returns true if the given object can be equaled with this object.TypeComparator<Row>createComparator(int[] logicalKeyFields, boolean[] orders, int logicalFieldOffset, ExecutionConfig config)Generic implementation of the comparator creation.TypeSerializer<Row>createLegacySerializer(SerializerConfig config)Deprecated.TypeSerializer<Row>createSerializer(ExecutionConfig config)CreateTypeSerializerfor this type.TypeSerializer<Row>createSerializer(SerializerConfig config)Creates a serializer for the type.protected CompositeType.TypeComparatorBuilder<Row>createTypeComparatorBuilder()booleanequals(Object obj)The equals method does only check for field types.intgetFieldIndex(String fieldName)Returns the field index of the composite field of the given name.String[]getFieldNames()Returns the names of the composite fields of this type.voidgetFlatFields(String fieldExpression, int offset, List<CompositeType.FlatFieldDescriptor> result)Computes the flat field descriptors for the given field expression with the given offset.<X> TypeInformation<X>getTypeAt(String fieldExpression)Returns the type of the (nested) field at the given field expression position.inthashCode()static RowTypeInfoprojectFields(RowTypeInfo rowType, int[] fieldMapping)Creates aRowTypeInfowith projected fields.booleanschemaEquals(Object obj)Tests whether an other object describes the same, schema-equivalent row information.StringtoString()-
Methods inherited from class org.apache.flink.api.java.typeutils.TupleTypeInfoBase
getArity, getFieldTypes, getTotalFields, getTypeAt, hasDeterministicFieldOrder, isBasicType, isCaseClass, isTupleType
-
Methods inherited from class org.apache.flink.api.common.typeutils.CompositeType
getFlatFields, getTypeClass, hasField, isKeyType, isSortKeyType
-
Methods inherited from class org.apache.flink.api.common.typeinfo.TypeInformation
getGenericParameters, of, of
-
-
-
-
Field Detail
-
fieldNames
protected final String[] fieldNames
-
-
Constructor Detail
-
RowTypeInfo
public RowTypeInfo(TypeInformation<?>... types)
-
RowTypeInfo
public RowTypeInfo(TypeInformation<?>[] types, String[] fieldNames)
-
-
Method Detail
-
getFlatFields
public void getFlatFields(String fieldExpression, int offset, List<CompositeType.FlatFieldDescriptor> result)
Description copied from class:CompositeTypeComputes the flat field descriptors for the given field expression with the given offset.- Overrides:
getFlatFieldsin classTupleTypeInfoBase<Row>- Parameters:
fieldExpression- The field expression for which the FlatFieldDescriptors are computed.offset- The offset to use when computing the positions of the flat fields.result- The list into which all flat field descriptors are inserted.
-
getTypeAt
public <X> TypeInformation<X> getTypeAt(String fieldExpression)
Description copied from class:CompositeTypeReturns the type of the (nested) field at the given field expression position. Wildcards are not allowed.- Overrides:
getTypeAtin classTupleTypeInfoBase<Row>- Parameters:
fieldExpression- The field expression for which the field of which the type is returned.- Returns:
- The type of the field at the given field expression.
-
createComparator
public TypeComparator<Row> createComparator(int[] logicalKeyFields, boolean[] orders, int logicalFieldOffset, ExecutionConfig config)
Description copied from class:CompositeTypeGeneric implementation of the comparator creation. Composite types are supplying the infrastructure to create the actual comparators- Overrides:
createComparatorin classCompositeType<Row>- Returns:
- The comparator
-
createTypeComparatorBuilder
protected CompositeType.TypeComparatorBuilder<Row> createTypeComparatorBuilder()
- Specified by:
createTypeComparatorBuilderin classCompositeType<Row>
-
getFieldNames
public String[] getFieldNames()
Description copied from class:CompositeTypeReturns the names of the composite fields of this type. The order of the returned array must be consistent with the internal field index ordering.- Specified by:
getFieldNamesin classCompositeType<Row>
-
getFieldIndex
public int getFieldIndex(String fieldName)
Description copied from class:CompositeTypeReturns the field index of the composite field of the given name.- Specified by:
getFieldIndexin classCompositeType<Row>- Returns:
- The field index or -1 if this type does not have a field of the given name.
-
createSerializer
public TypeSerializer<Row> createSerializer(SerializerConfig config)
Description copied from class:TypeInformationCreates a serializer for the type. The serializer may use the ExecutionConfig for parameterization.- Overrides:
createSerializerin classTypeInformation<Row>- Parameters:
config- The config used to parameterize the serializer.- Returns:
- A serializer for this type.
-
createSerializer
public TypeSerializer<Row> createSerializer(ExecutionConfig config)
Description copied from class:TypeInformationCreateTypeSerializerfor this type.- Specified by:
createSerializerin classTypeInformation<Row>- Parameters:
config- the configuration of this job execution
-
canEqual
public boolean canEqual(Object obj)
Description copied from class:TypeInformationReturns true if the given object can be equaled with this object. If not, it returns false.- Overrides:
canEqualin classTupleTypeInfoBase<Row>- Parameters:
obj- Object which wants to take part in the equality relation- Returns:
- true if obj can be equaled with this, otherwise false
-
hashCode
public int hashCode()
- Overrides:
hashCodein classTupleTypeInfoBase<Row>
-
equals
public boolean equals(Object obj)
The equals method does only check for field types. Field names do not matter during runtime so we can consider rows with the same field types as equal. UseschemaEquals(Object)for checking schema-equivalence.- Overrides:
equalsin classTupleTypeInfoBase<Row>
-
toString
public String toString()
- Overrides:
toStringin classTupleTypeInfoBase<Row>
-
createLegacySerializer
@Deprecated public TypeSerializer<Row> createLegacySerializer(SerializerConfig config)
Deprecated.Creates a serializer for the oldRowformat before Flink 1.11.The serialization format has changed from 1.10 to 1.11 and added
Row.getKind().
-
schemaEquals
public boolean schemaEquals(Object obj)
Tests whether an other object describes the same, schema-equivalent row information.
-
projectFields
public static RowTypeInfo projectFields(RowTypeInfo rowType, int[] fieldMapping)
Creates aRowTypeInfowith projected fields.- Parameters:
rowType- The original RowTypeInfo whose fields are projectedfieldMapping- The field mapping of the projection- Returns:
- A RowTypeInfo with projected fields.
-
-