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 kind, constraints, 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 class
Schema.Builder
A builder for constructing an immutable but still unresolvedSchema
.static class
Schema.UnresolvedColumn
Super class for all kinds of columns in an unresolved schema.static class
Schema.UnresolvedComputedColumn
Declaration of a computed column that will be resolved toColumn.ComputedColumn
during schema resolution.static class
Schema.UnresolvedConstraint
Super class for all kinds of constraints in an unresolved schema.static class
Schema.UnresolvedMetadataColumn
Declaration of a metadata column that will be resolved toColumn.MetadataColumn
during schema resolution.static class
Schema.UnresolvedPhysicalColumn
Declaration of a physical column that will be resolved toColumn.PhysicalColumn
during schema resolution.static class
Schema.UnresolvedPrimaryKey
Declaration of a primary key that will be resolved toUniqueConstraint
during schema resolution.static class
Schema.UnresolvedWatermarkSpec
Declaration of a watermark strategy that will be resolved toWatermarkSpec
during schema resolution.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static Schema
derived()
Convenience method for stating explicitly that a schema is empty and should be fully derived by the framework.boolean
equals(Object o)
List<Schema.UnresolvedColumn>
getColumns()
Optional<Schema.UnresolvedPrimaryKey>
getPrimaryKey()
List<Schema.UnresolvedWatermarkSpec>
getWatermarkSpecs()
int
hashCode()
static Schema.Builder
newBuilder()
Builder for configuring and creating instances ofSchema
.ResolvedSchema
resolve(SchemaResolver resolver)
Resolves the givenSchema
to a validatedResolvedSchema
.String
toString()
-
-
-
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
Schema
instance 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()
-
resolve
public ResolvedSchema resolve(SchemaResolver resolver)
Resolves the givenSchema
to a validatedResolvedSchema
.
-
-