public class FieldInfoUtils extends Object
TypeInformation
s.Modifier and Type | Class and Description |
---|---|
static class |
FieldInfoUtils.TypeInfoSchema
Describes fields' names, indices and
DataType s extracted from a TypeInformation and possibly
transformed via Expression application. |
Modifier and Type | Method and Description |
---|---|
static int[] |
getFieldIndices(TypeInformation<?> inputType)
Returns field indexes for a given
TypeInformation . |
static <A> String[] |
getFieldNames(TypeInformation<A> inputType)
Returns field names for a given
TypeInformation . |
static <A> String[] |
getFieldNames(TypeInformation<A> inputType,
List<String> existingNames)
Returns field names for a given
TypeInformation . |
static <A> FieldInfoUtils.TypeInfoSchema |
getFieldsInfo(TypeInformation<A> inputType)
Returns a
FieldInfoUtils.TypeInfoSchema for a given TypeInformation . |
static <A> FieldInfoUtils.TypeInfoSchema |
getFieldsInfo(TypeInformation<A> inputType,
Expression[] expressions)
Returns a
FieldInfoUtils.TypeInfoSchema for a given TypeInformation . |
static TypeInformation<?>[] |
getFieldTypes(TypeInformation<?> inputType)
Returns field types for a given
TypeInformation . |
static boolean |
isReferenceByPosition(CompositeType<?> ct,
Expression[] fields)
Reference input fields by name:
All fields in the schema definition are referenced by name
(and possibly renamed using an alias (as).
|
static <A> void |
validateInputTypeInfo(TypeInformation<A> typeInfo)
Validate if class represented by the typeInfo is static and globally accessible.
|
public static boolean isReferenceByPosition(CompositeType<?> ct, Expression[] fields)
Reference input fields by position: In this mode, fields are simply renamed. Event-time attributes can replace the field on their position in the input data (if it is of correct type) or be appended at the end. Proctime attributes must be appended at the end. This mode can only be used if the input type has a defined field order (tuple, case class, Row) and no of fields references a field of the input type.
public static <A> FieldInfoUtils.TypeInfoSchema getFieldsInfo(TypeInformation<A> inputType)
FieldInfoUtils.TypeInfoSchema
for a given TypeInformation
.A
- The type of the TypeInformation.inputType
- The TypeInformation to extract the mapping from.TableSchema
.FieldInfoUtils.TypeInfoSchema
public static <A> FieldInfoUtils.TypeInfoSchema getFieldsInfo(TypeInformation<A> inputType, Expression[] expressions)
FieldInfoUtils.TypeInfoSchema
for a given TypeInformation
.
It gives control of the process of mapping TypeInformation
to TableSchema
(via FieldInfoUtils.TypeInfoSchema
).
Possible operations via the expressions include:
TimestampType
.A
- The type of the TypeInformation.inputType
- The TypeInformation to extract the mapping from.expressions
- Expressions to apply while extracting the mapping.TableSchema
.FieldInfoUtils.TypeInfoSchema
public static <A> String[] getFieldNames(TypeInformation<A> inputType)
TypeInformation
.A
- The type of the TypeInformation.inputType
- The TypeInformation extract the field names.public static <A> String[] getFieldNames(TypeInformation<A> inputType, List<String> existingNames)
TypeInformation
. If the input TypeInformation
is not a composite type, the result field name should not exist in the existingNames.A
- The type of the TypeInformation.inputType
- The TypeInformation extract the field names.existingNames
- The existing field names for non-composite types that can not be used.public static <A> void validateInputTypeInfo(TypeInformation<A> typeInfo)
typeInfo
- type to checkValidationException
- if type does not meet these criteriapublic static int[] getFieldIndices(TypeInformation<?> inputType)
TypeInformation
.inputType
- The TypeInformation extract the field positions from.public static TypeInformation<?>[] getFieldTypes(TypeInformation<?> inputType)
TypeInformation
.inputType
- The TypeInformation to extract field types from.Copyright © 2014–2020 The Apache Software Foundation. All rights reserved.