@PublicEvolving public class Schema extends Object implements Descriptor
Note: Field names are matched by the exact name by default (case sensitive).
Modifier and Type | Field and Description |
---|---|
static String |
SCHEMA |
static String |
SCHEMA_DATA_TYPE |
static String |
SCHEMA_FROM |
static String |
SCHEMA_NAME |
static String |
SCHEMA_PROCTIME |
static String |
SCHEMA_TYPE
|
Constructor and Description |
---|
Schema() |
Modifier and Type | Method and Description |
---|---|
Schema |
field(String fieldName,
DataType fieldType)
Adds a field with the field name and the data type.
|
Schema |
field(String fieldName,
String fieldType)
Adds a field with the field name and the type string.
|
Schema |
field(String fieldName,
TypeInformation<?> fieldType)
Deprecated.
This method will be removed in future versions as it uses the old type system.
Please use
field(String, DataType) instead. |
Schema |
from(String originFieldName)
Specifies the origin of the previously defined field.
|
Schema |
proctime()
Specifies the previously defined field as a processing-time attribute.
|
Schema |
rowtime(Rowtime rowtime)
Specifies the previously defined field as an event-time attribute.
|
Schema |
schema(TableSchema schema)
Sets the schema with field names and the types.
|
Map<String,String> |
toProperties()
Converts this descriptor into a set of properties.
|
public static final String SCHEMA
public static final String SCHEMA_NAME
@Deprecated public static final String SCHEMA_TYPE
Schema
uses the legacy type key (e.g. schema.0.type = LONG) to store type
information in prior v1.9. Since v1.10, Schema
uses data type key (e.g.
schema.0.data-type = BIGINT) to store types.public static final String SCHEMA_DATA_TYPE
public static final String SCHEMA_PROCTIME
public static final String SCHEMA_FROM
public Schema schema(TableSchema schema)
This method overwrites existing fields added with field(String, DataType)
.
schema
- the table schemapublic Schema field(String fieldName, DataType fieldType)
fieldName
- the field namefieldType
- the type information of the field@Deprecated public Schema field(String fieldName, TypeInformation<?> fieldType)
field(String, DataType)
instead.fieldName
- the field namefieldType
- the type information of the fieldpublic Schema field(String fieldName, String fieldType)
NOTE: the fieldType string should follow the type string defined in LogicalTypeParser
. This method also keeps compatible with old type string defined in TypeStringUtils
but will be dropped in future versions as it uses the old type system.
fieldName
- the field namefieldType
- the type string of the fieldpublic Schema from(String originFieldName)
E.g. field("myString", Types.STRING).from("CSV_MY_STRING")
Note: Field names are matched by the exact name by default (case sensitive).
public Schema proctime()
E.g. field("proctime", Types.SQL_TIMESTAMP).proctime()
public Schema rowtime(Rowtime rowtime)
E.g. field("rowtime", Types.SQL_TIMESTAMP).rowtime(...)
public Map<String,String> toProperties()
toProperties
in interface Descriptor
Copyright © 2014–2021 The Apache Software Foundation. All rights reserved.