@PublicEvolving public class Schema extends Object implements Descriptor
Note: Field names are matched by the exact name by default (case sensitive).
| 限定符和类型 | 字段和说明 |
|---|---|
static String |
SCHEMA |
static String |
SCHEMA_DATA_TYPE |
static String |
SCHEMA_FROM |
static String |
SCHEMA_NAME |
static String |
SCHEMA_PROCTIME |
static String |
SCHEMA_TYPE
|
| 构造器和说明 |
|---|
Schema() |
| 限定符和类型 | 方法和说明 |
|---|---|
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,
org.apache.flink.api.common.typeinfo.TypeInformation<?> fieldType)
已过时。
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.
|
@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 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, org.apache.flink.api.common.typeinfo.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 在接口中 DescriptorCopyright © 2014–2021 The Apache Software Foundation. All rights reserved.