@Internal public class TableSchemaUtils extends Object
TableSchema
.Constructor and Description |
---|
TableSchemaUtils() |
Modifier and Type | Method and Description |
---|---|
static TableSchema.Builder |
builderWithGivenSchema(TableSchema oriSchema)
Creates a builder with given table schema.
|
static TableSchema |
checkOnlyPhysicalColumns(TableSchema schema)
Throws an exception if the given
TableSchema contains any non-physical columns. |
static boolean |
containsPhysicalColumnsOnly(TableSchema schema)
Returns true if there are only physical columns in the given
TableSchema . |
static TableSchema |
dropConstraint(TableSchema oriSchema,
String constraintName)
Creates a new schema but drop the constraint with given name.
|
static TableSchema |
getPersistedSchema(TableSchema tableSchema)
Return
TableSchema which consists of all persisted columns. |
static TableSchema |
getPhysicalSchema(TableSchema tableSchema)
Return
TableSchema which consists of all physical columns. |
static int[] |
getPrimaryKeyIndices(TableSchema schema)
Returns the field indices of primary key in the physical columns of this schema (not include
computed columns or metadata columns).
|
static TableSchema |
removeTimeAttributeFromResolvedSchema(ResolvedSchema resolvedSchema)
Removes time attributes from the
ResolvedSchema and build a TableSchema . |
public static TableSchema getPhysicalSchema(TableSchema tableSchema)
TableSchema
which consists of all physical columns. That means, the computed
columns and metadata columns are filtered out.
Readers(or writers) such as TableSource
and TableSink
should use this
physical schema to generate TableSource.getProducedDataType()
and TableSource.getTableSchema()
rather than using the raw TableSchema which may contains
additional columns.
public static TableSchema getPersistedSchema(TableSchema tableSchema)
TableSchema
which consists of all persisted columns. That means, the virtual
computed columns and metadata columns are filtered out.
Its difference from getPhysicalSchema(TableSchema)
is that it
includes of all physical columns and metadata columns without virtual keyword.
public static boolean containsPhysicalColumnsOnly(TableSchema schema)
TableSchema
.public static TableSchema checkOnlyPhysicalColumns(TableSchema schema)
TableSchema
contains any non-physical columns.public static int[] getPrimaryKeyIndices(TableSchema schema)
public static TableSchema removeTimeAttributeFromResolvedSchema(ResolvedSchema resolvedSchema)
ResolvedSchema
and build a TableSchema
.public static TableSchema.Builder builderWithGivenSchema(TableSchema oriSchema)
oriSchema
- Original schemapublic static TableSchema dropConstraint(TableSchema oriSchema, String constraintName)
Copyright © 2014–2023 The Apache Software Foundation. All rights reserved.