Class Column

java.lang.Object
org.apache.flink.table.catalog.Column
Direct Known Subclasses:
Column.ComputedColumn, Column.MetadataColumn, Column.PhysicalColumn

@PublicEvolving public abstract class Column extends Object
Representation of a column in a ResolvedSchema.

A table column describes either a Column.PhysicalColumn, Column.ComputedColumn, or Column.MetadataColumn.

Every column is fully resolved. The enclosed DataType indicates whether the column is a time attribute and thus might differ from the original data type.

  • Field Details

    • name

      protected final String name
    • dataType

      protected final DataType dataType
    • comment

      @Nullable protected final String comment
  • Method Details

    • physical

      public static Column.PhysicalColumn physical(String name, DataType dataType)
      Creates a regular table column that represents physical data.
    • computed

      public static Column.ComputedColumn computed(String name, ResolvedExpression expression)
      Creates a computed column that is computed from the given ResolvedExpression.
    • metadata

      public static Column.MetadataColumn metadata(String name, DataType dataType, @Nullable String metadataKey, boolean isVirtual)
      Creates a metadata column from metadata of the given column name or from metadata of the given key (if not null).

      Allows to specify whether the column is virtual or not.

    • withComment

      public abstract Column withComment(@Nullable String comment)
      Add the comment to the column and return the new object.
    • isPhysical

      public abstract boolean isPhysical()
      Returns whether the given column is a physical column of a table; neither computed nor metadata.
    • isPersisted

      public abstract boolean isPersisted()
      Returns whether the given column is persisted in a sink operation.
    • getDataType

      public DataType getDataType()
      Returns the data type of this column.
    • getName

      public String getName()
      Returns the name of this column.
    • getComment

      public Optional<String> getComment()
      Returns the comment of this column.
    • asSummaryString

      public String asSummaryString()
      Returns a string that summarizes this column for printing to a console.
    • explainExtras

      public abstract Optional<String> explainExtras()
      Returns an explanation of specific column extras next to name and type.
    • copy

      public abstract Column copy(DataType newType)
      Returns a copy of the column with a replaced DataType.
    • rename

      public abstract Column rename(String newName)
      Returns a copy of the column with a replaced name.
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object