@Evolving
public interface Column
Table
. It defines basic properties of a column,
such as name and data type, as well as some advanced ones like default column value.
Data Sources do not need to implement it. They should consume it in APIs like
TableCatalog.createTable(Identifier, Column[], Transform[], Map)
, and report it in
Table.columns()
by calling the static create
functions of this interface to
create it.
A column cannot have both a default value and a generation expression.
Modifier and Type | Method and Description |
---|---|
String |
comment()
Returns the comment of this table column.
|
static Column |
create(String name,
DataType dataType) |
static Column |
create(String name,
DataType dataType,
boolean nullable) |
static Column |
create(String name,
DataType dataType,
boolean nullable,
String comment,
ColumnDefaultValue defaultValue,
String metadataInJSON) |
static Column |
create(String name,
DataType dataType,
boolean nullable,
String comment,
String metadataInJSON) |
static Column |
create(String name,
DataType dataType,
boolean nullable,
String comment,
String generationExpression,
String metadataInJSON) |
DataType |
dataType()
Returns the data type of this table column.
|
ColumnDefaultValue |
defaultValue()
Returns the default value of this table column.
|
String |
generationExpression()
Returns the generation expression of this table column.
|
String |
metadataInJSON()
Returns the column metadata in JSON format.
|
String |
name()
Returns the name of this table column.
|
boolean |
nullable()
Returns true if this column may produce null values.
|
static Column create(String name, DataType dataType, boolean nullable, String comment, String metadataInJSON)
static Column create(String name, DataType dataType, boolean nullable, String comment, ColumnDefaultValue defaultValue, String metadataInJSON)
static Column create(String name, DataType dataType, boolean nullable, String comment, String generationExpression, String metadataInJSON)
String name()
DataType dataType()
boolean nullable()
@Nullable String comment()
@Nullable ColumnDefaultValue defaultValue()
@Nullable String generationExpression()
The generation expression is stored as spark SQL dialect. It is up to the data source to verify expression compatibility and reject writes as necessary.
@Nullable String metadataInJSON()