Interface Column


@Evolving public interface Column
An interface representing a column of a 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.

  • Method Details

    • create

      static Column create(String name, DataType dataType)
    • create

      static Column create(String name, DataType dataType, boolean nullable)
    • create

      static Column create(String name, DataType dataType, boolean nullable, String comment, String metadataInJSON)
    • create

      static Column create(String name, DataType dataType, boolean nullable, String comment, ColumnDefaultValue defaultValue, String metadataInJSON)
    • create

      static Column create(String name, DataType dataType, boolean nullable, String comment, String generationExpression, String metadataInJSON)
    • name

      String name()
      Returns the name of this table column.
    • dataType

      DataType dataType()
      Returns the data type of this table column.
    • nullable

      boolean nullable()
      Returns true if this column may produce null values.
    • comment

      @Nullable String comment()
      Returns the comment of this table column. Null means no comment.
    • defaultValue

      @Nullable ColumnDefaultValue defaultValue()
      Returns the default value of this table column. Null means no default value.
    • generationExpression

      @Nullable String generationExpression()
      Returns the generation expression of this table column. Null means no generation expression.

      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.

    • metadataInJSON

      @Nullable String metadataInJSON()
      Returns the column metadata in JSON format.