Class PrimitiveArrayTypeInfo<T>
- java.lang.Object
-
- org.apache.flink.api.common.typeinfo.TypeInformation<T>
-
- org.apache.flink.api.common.typeinfo.PrimitiveArrayTypeInfo<T>
-
- Type Parameters:
T
- The type represented by this type information, e.g., int[], double[], long[]
- All Implemented Interfaces:
Serializable
,AtomicType<T>
@Public public class PrimitiveArrayTypeInfo<T> extends TypeInformation<T> implements AtomicType<T>
ATypeInformation
for arrays of primitive types (int, long, double, ...). Supports the creation of dedicated efficient serializers for these types.- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description static PrimitiveArrayTypeInfo<boolean[]>
BOOLEAN_PRIMITIVE_ARRAY_TYPE_INFO
static PrimitiveArrayTypeInfo<byte[]>
BYTE_PRIMITIVE_ARRAY_TYPE_INFO
static PrimitiveArrayTypeInfo<char[]>
CHAR_PRIMITIVE_ARRAY_TYPE_INFO
static PrimitiveArrayTypeInfo<double[]>
DOUBLE_PRIMITIVE_ARRAY_TYPE_INFO
static PrimitiveArrayTypeInfo<float[]>
FLOAT_PRIMITIVE_ARRAY_TYPE_INFO
static PrimitiveArrayTypeInfo<int[]>
INT_PRIMITIVE_ARRAY_TYPE_INFO
static PrimitiveArrayTypeInfo<long[]>
LONG_PRIMITIVE_ARRAY_TYPE_INFO
static PrimitiveArrayTypeInfo<short[]>
SHORT_PRIMITIVE_ARRAY_TYPE_INFO
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
canEqual(Object obj)
Returns true if the given object can be equaled with this object.PrimitiveArrayComparator<T,?>
createComparator(boolean sortOrderAscending, ExecutionConfig executionConfig)
Creates a comparator for this type.TypeSerializer<T>
createSerializer(SerializerConfig serializerConfig)
Creates a serializer for the type.boolean
equals(Object other)
int
getArity()
Gets the arity of this type - the number of fields without nesting.Class<?>
getComponentClass()
Gets the class that represents the component type.TypeInformation<?>
getComponentType()
Gets the type information of the component type.static <X> PrimitiveArrayTypeInfo<X>
getInfoFor(Class<X> type)
Tries to get the PrimitiveArrayTypeInfo for an array.int
getTotalFields()
Gets the number of logical fields in this type.Class<T>
getTypeClass()
Gets the class of the type represented by this type information.int
hashCode()
boolean
isBasicType()
Checks if this type information represents a basic type.boolean
isKeyType()
Checks whether this type can be used as a key.boolean
isTupleType()
Checks if this type information represents a Tuple type.String
toString()
-
Methods inherited from class org.apache.flink.api.common.typeinfo.TypeInformation
getGenericParameters, isSortKeyType, of, of
-
-
-
-
Field Detail
-
BOOLEAN_PRIMITIVE_ARRAY_TYPE_INFO
public static final PrimitiveArrayTypeInfo<boolean[]> BOOLEAN_PRIMITIVE_ARRAY_TYPE_INFO
-
BYTE_PRIMITIVE_ARRAY_TYPE_INFO
public static final PrimitiveArrayTypeInfo<byte[]> BYTE_PRIMITIVE_ARRAY_TYPE_INFO
-
SHORT_PRIMITIVE_ARRAY_TYPE_INFO
public static final PrimitiveArrayTypeInfo<short[]> SHORT_PRIMITIVE_ARRAY_TYPE_INFO
-
INT_PRIMITIVE_ARRAY_TYPE_INFO
public static final PrimitiveArrayTypeInfo<int[]> INT_PRIMITIVE_ARRAY_TYPE_INFO
-
LONG_PRIMITIVE_ARRAY_TYPE_INFO
public static final PrimitiveArrayTypeInfo<long[]> LONG_PRIMITIVE_ARRAY_TYPE_INFO
-
FLOAT_PRIMITIVE_ARRAY_TYPE_INFO
public static final PrimitiveArrayTypeInfo<float[]> FLOAT_PRIMITIVE_ARRAY_TYPE_INFO
-
DOUBLE_PRIMITIVE_ARRAY_TYPE_INFO
public static final PrimitiveArrayTypeInfo<double[]> DOUBLE_PRIMITIVE_ARRAY_TYPE_INFO
-
CHAR_PRIMITIVE_ARRAY_TYPE_INFO
public static final PrimitiveArrayTypeInfo<char[]> CHAR_PRIMITIVE_ARRAY_TYPE_INFO
-
-
Method Detail
-
isBasicType
@PublicEvolving public boolean isBasicType()
Description copied from class:TypeInformation
Checks if this type information represents a basic type. Basic types are defined inBasicTypeInfo
and are primitives, their boxing types, Strings, Date, Void, ...- Specified by:
isBasicType
in classTypeInformation<T>
- Returns:
- True, if this type information describes a basic type, false otherwise.
-
isTupleType
@PublicEvolving public boolean isTupleType()
Description copied from class:TypeInformation
Checks if this type information represents a Tuple type. Tuple types are subclasses of the Java API tuples.- Specified by:
isTupleType
in classTypeInformation<T>
- Returns:
- True, if this type information describes a tuple type, false otherwise.
-
getArity
@PublicEvolving public int getArity()
Description copied from class:TypeInformation
Gets the arity of this type - the number of fields without nesting.- Specified by:
getArity
in classTypeInformation<T>
- Returns:
- Gets the number of fields in this type without nesting.
-
getTotalFields
@PublicEvolving public int getTotalFields()
Description copied from class:TypeInformation
Gets the number of logical fields in this type. This includes its nested and transitively nested fields, in the case of composite types. In the example above, the OuterType type has three fields in total.The total number of fields must be at least 1.
- Specified by:
getTotalFields
in classTypeInformation<T>
- Returns:
- The number of fields in this type, including its sub-fields (for composite types)
-
getTypeClass
@PublicEvolving public Class<T> getTypeClass()
Description copied from class:TypeInformation
Gets the class of the type represented by this type information.- Specified by:
getTypeClass
in classTypeInformation<T>
- Returns:
- The class of the type represented by this type information.
-
isKeyType
@PublicEvolving public boolean isKeyType()
Description copied from class:TypeInformation
Checks whether this type can be used as a key. As a bare minimum, types have to be hashable and comparable to be keys.- Specified by:
isKeyType
in classTypeInformation<T>
- Returns:
- True, if the type can be used as a key, false otherwise.
-
createSerializer
@PublicEvolving public TypeSerializer<T> createSerializer(SerializerConfig serializerConfig)
Description copied from class:TypeInformation
Creates a serializer for the type. The serializer may use the ExecutionConfig for parameterization.- Specified by:
createSerializer
in classTypeInformation<T>
- Parameters:
serializerConfig
- The config used to parameterize the serializer.- Returns:
- A serializer for this type.
-
getComponentClass
@PublicEvolving public Class<?> getComponentClass()
Gets the class that represents the component type.- Returns:
- The class of the component type.
-
getComponentType
@PublicEvolving public TypeInformation<?> getComponentType()
Gets the type information of the component type.- Returns:
- The type information of the component type.
-
toString
public String toString()
- Specified by:
toString
in classTypeInformation<T>
-
equals
public boolean equals(Object other)
- Specified by:
equals
in classTypeInformation<T>
-
hashCode
public int hashCode()
- Specified by:
hashCode
in classTypeInformation<T>
-
canEqual
public boolean canEqual(Object obj)
Description copied from class:TypeInformation
Returns true if the given object can be equaled with this object. If not, it returns false.- Specified by:
canEqual
in classTypeInformation<T>
- Parameters:
obj
- Object which wants to take part in the equality relation- Returns:
- true if obj can be equaled with this, otherwise false
-
getInfoFor
@PublicEvolving public static <X> PrimitiveArrayTypeInfo<X> getInfoFor(Class<X> type)
Tries to get the PrimitiveArrayTypeInfo for an array. Returns null, if the type is an array, but the component type is not a primitive type.- Parameters:
type
- The class of the array.- Returns:
- The corresponding PrimitiveArrayTypeInfo, or null, if the array is not an array of primitives.
- Throws:
InvalidTypesException
- Thrown, if the given class does not represent an array.
-
createComparator
@PublicEvolving public PrimitiveArrayComparator<T,?> createComparator(boolean sortOrderAscending, ExecutionConfig executionConfig)
Description copied from interface:AtomicType
Creates a comparator for this type.- Specified by:
createComparator
in interfaceAtomicType<T>
- Parameters:
sortOrderAscending
- True, if the comparator should define the order to be ascending, false, if the comparator should define the order to be descending.executionConfig
- The config from which the comparator will be parametrized. Parametrization includes for example registration of class tags for frameworks like Kryo.- Returns:
- A comparator for this type.
-
-