@PublicEvolving public class TableSchema extends Object
Modifier and Type | Class and Description |
---|---|
static class |
TableSchema.Builder
Builder for creating a
TableSchema . |
Constructor and Description |
---|
TableSchema(String[] fieldNames,
TypeInformation<?>[] fieldTypes) |
Modifier and Type | Method and Description |
---|---|
static TableSchema.Builder |
builder() |
TableSchema |
copy()
Returns a deep copy of the table schema.
|
boolean |
equals(Object o) |
static TableSchema |
fromTypeInfo(TypeInformation<?> typeInfo)
Creates a table schema from a
TypeInformation instance. |
String[] |
getColumnNames()
Deprecated.
Use
getFieldNames() instead. Can be dropped after 1.7. |
int |
getFieldCount()
Returns the number of fields.
|
Optional<String> |
getFieldName(int fieldIndex)
Returns the specified name for the given field index.
|
String[] |
getFieldNames()
Returns all field names as an array.
|
Optional<TypeInformation<?>> |
getFieldType(int fieldIndex)
Returns the specified type information for the given field index.
|
Optional<TypeInformation<?>> |
getFieldType(String fieldName)
Returns the specified type information for the given field name.
|
TypeInformation<?>[] |
getFieldTypes()
Returns all field type information as an array.
|
TypeInformation<?>[] |
getTypes()
Deprecated.
Use
getFieldTypes() instead. Can be dropped after 1.7. |
int |
hashCode() |
TypeInformation<Row> |
toRowType()
Converts a table schema into a (nested) type information describing a
Row . |
String |
toString() |
public TableSchema(String[] fieldNames, TypeInformation<?>[] fieldTypes)
public TableSchema copy()
public TypeInformation<?>[] getFieldTypes()
public Optional<TypeInformation<?>> getFieldType(int fieldIndex)
fieldIndex
- the index of the fieldpublic Optional<TypeInformation<?>> getFieldType(String fieldName)
fieldName
- the name of the fieldpublic int getFieldCount()
public String[] getFieldNames()
public Optional<String> getFieldName(int fieldIndex)
fieldIndex
- the index of the field@Deprecated public TypeInformation<?>[] getTypes()
getFieldTypes()
instead. Can be dropped after 1.7.@Deprecated public String[] getColumnNames()
getFieldNames()
instead. Can be dropped after 1.7.public TypeInformation<Row> toRowType()
Row
.public static TableSchema fromTypeInfo(TypeInformation<?> typeInfo)
TypeInformation
instance. If the type information is
a CompositeType
, the field names and types for the composite type are used to
construct the TableSchema
instance. Otherwise, a table schema with a single field
is created. The field name is "f0" and the field type the provided type.typeInfo
- The TypeInformation
from which the table schema is generated.TypeInformation
.public static TableSchema.Builder builder()
Copyright © 2014–2020 The Apache Software Foundation. All rights reserved.