Class Schema
- java.lang.Object
-
- org.apache.flink.table.api.Schema
-
@PublicEvolving public final class Schema extends Object
Schema of a table or view.A schema represents the schema part of a
CREATE TABLE (schema) WITH (options)DDL statement in SQL. It defines columns of different kinds, constraints, indexes, time attributes, and watermark strategies. It is possible to reference objects (such as functions or types) across different catalogs.This class is used in the API and catalogs to define an unresolved schema that will be translated to
ResolvedSchema. Some methods of this class perform basic validation, however, the main validation happens during the resolution. Thus, an unresolved schema can be incomplete and might be enriched or merged with a different schema at a later stage.Since an instance of this class is unresolved, it should not be directly persisted. The
toString()shows only a summary of the contained objects.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classSchema.BuilderA builder for constructing an immutable but still unresolvedSchema.static classSchema.UnresolvedColumnSuper class for all kinds of columns in an unresolved schema.static classSchema.UnresolvedComputedColumnDeclaration of a computed column that will be resolved toColumn.ComputedColumnduring schema resolution.static classSchema.UnresolvedConstraintSuper class for all kinds of constraints in an unresolved schema.static classSchema.UnresolvedIndexDeclaration of an index that will be resolved toIndexduring schema resolution.static classSchema.UnresolvedMetadataColumnDeclaration of a metadata column that will be resolved toColumn.MetadataColumnduring schema resolution.static classSchema.UnresolvedPhysicalColumnDeclaration of a physical column that will be resolved toColumn.PhysicalColumnduring schema resolution.static classSchema.UnresolvedPrimaryKeyDeclaration of a primary key that will be resolved toUniqueConstraintduring schema resolution.static classSchema.UnresolvedWatermarkSpecDeclaration of a watermark strategy that will be resolved toWatermarkSpecduring schema resolution.
-
Constructor Summary
Constructors Constructor Description Schema(List<Schema.UnresolvedColumn> columns, List<Schema.UnresolvedWatermarkSpec> watermarkSpecs, Schema.UnresolvedPrimaryKey primaryKey)Deprecated.Schema(List<Schema.UnresolvedColumn> columns, List<Schema.UnresolvedWatermarkSpec> watermarkSpecs, Schema.UnresolvedPrimaryKey primaryKey, List<Schema.UnresolvedIndex> indexes)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static Schemaderived()Convenience method for stating explicitly that a schema is empty and should be fully derived by the framework.booleanequals(Object o)List<Schema.UnresolvedColumn>getColumns()List<Schema.UnresolvedIndex>getIndexes()Optional<Schema.UnresolvedPrimaryKey>getPrimaryKey()List<Schema.UnresolvedWatermarkSpec>getWatermarkSpecs()inthashCode()static Schema.BuildernewBuilder()Builder for configuring and creating instances ofSchema.ResolvedSchemaresolve(SchemaResolver resolver)Resolves the givenSchemato a validatedResolvedSchema.StringtoString()
-
-
-
Constructor Detail
-
Schema
@Deprecated public Schema(List<Schema.UnresolvedColumn> columns, List<Schema.UnresolvedWatermarkSpec> watermarkSpecs, @Nullable Schema.UnresolvedPrimaryKey primaryKey)
Deprecated.Please useSchema(List, List, UnresolvedPrimaryKey, List)instead.
-
Schema
public Schema(List<Schema.UnresolvedColumn> columns, List<Schema.UnresolvedWatermarkSpec> watermarkSpecs, @Nullable Schema.UnresolvedPrimaryKey primaryKey, List<Schema.UnresolvedIndex> indexes)
-
-
Method Detail
-
newBuilder
public static Schema.Builder newBuilder()
Builder for configuring and creating instances ofSchema.
-
derived
public static Schema derived()
Convenience method for stating explicitly that a schema is empty and should be fully derived by the framework.The semantics are equivalent to calling
Schema.newBuilder().build().Note that derivation depends on the context. Usually, the method that accepts a
Schemainstance will mention whether schema derivation is supported or not.
-
getColumns
public List<Schema.UnresolvedColumn> getColumns()
-
getWatermarkSpecs
public List<Schema.UnresolvedWatermarkSpec> getWatermarkSpecs()
-
getPrimaryKey
public Optional<Schema.UnresolvedPrimaryKey> getPrimaryKey()
-
getIndexes
public List<Schema.UnresolvedIndex> getIndexes()
-
resolve
public ResolvedSchema resolve(SchemaResolver resolver)
Resolves the givenSchemato a validatedResolvedSchema.
-
-