Class UniqueConstraint

java.lang.Object
org.apache.flink.table.catalog.UniqueConstraint
All Implemented Interfaces:
Constraint

@PublicEvolving public final class UniqueConstraint extends Object
A unique key constraint. It can be declared also as a PRIMARY KEY.
See Also:
  • Method Details

    • primaryKey

      public static UniqueConstraint primaryKey(String name, List<String> columns)
      Creates a non enforced Constraint.ConstraintType.PRIMARY_KEY constraint.
    • getColumns

      public List<String> getColumns()
      List of column names for which the primary key was defined.
    • getType

      public Constraint.ConstraintType getType()
      Description copied from interface: Constraint
      Tells what kind of constraint it is, e.g. PRIMARY KEY, UNIQUE, ...
    • asSummaryString

      public final String asSummaryString()
      Returns constraint's summary. All constraints summary will be formatted as
       CONSTRAINT [constraint-name] [constraint-type] ([constraint-definition])
      
       E.g CONSTRAINT pk PRIMARY KEY (`f0`, `f1`) NOT ENFORCED
       
    • equals

      public boolean equals(Object o)
    • hashCode

      public int hashCode()
    • getName

      public String getName()
      Specified by:
      getName in interface Constraint
    • isEnforced

      public boolean isEnforced()
      Description copied from interface: Constraint
      Constraints can either be enforced or non-enforced. If a constraint is enforced it will be checked whenever any SQL statement is executed that results in data or schema changes. If the constraint is not enforced the owner of the data is responsible for ensuring data integrity. Flink will rely the information is valid and might use it for query optimisations.
      Specified by:
      isEnforced in interface Constraint
    • toString

      public String toString()
      Overrides:
      toString in class Object