Class SqlTableConstraint

java.lang.Object
org.apache.calcite.sql.SqlNode
org.apache.calcite.sql.SqlCall
org.apache.flink.sql.parser.ddl.constraint.SqlTableConstraint
All Implemented Interfaces:
Cloneable

public class SqlTableConstraint extends org.apache.calcite.sql.SqlCall
Table constraint of a table definition.

Syntax from SQL-2011 IWD 9075-2:201?(E) 11.3 <table definition>:

 <table constraint definition> ::=
   [ <constraint name definition> ] <table constraint>
       [ <constraint characteristics> ]

 <table constraint> ::=
     <unique constraint definition>

 <unique constraint definition> ::=
     <unique specification> <left paren> <unique column list> <right paren>

 <unique specification> ::=
     UNIQUE
   | PRIMARY KEY
 
  • Field Summary

    Fields inherited from class org.apache.calcite.sql.SqlNode

    EMPTY_ARRAY, pos
  • Constructor Summary

    Constructors
    Constructor
    Description
    SqlTableConstraint(org.apache.calcite.sql.SqlIdentifier constraintName, org.apache.calcite.sql.SqlLiteral uniqueSpec, org.apache.calcite.sql.SqlNodeList columns, org.apache.calcite.sql.SqlLiteral enforcement, boolean isTableConstraint, org.apache.calcite.sql.parser.SqlParserPos pos)
    Creates a table constraint node.
  • Method Summary

    Modifier and Type
    Method
    Description
    Returns the columns as a string array.
    org.apache.calcite.sql.SqlNodeList
     
     
    Optional<org.apache.calcite.sql.SqlIdentifier>
     
    List<org.apache.calcite.sql.SqlNode>
     
    org.apache.calcite.sql.SqlOperator
     
    boolean
    Returns whether the constraint is enforced.
    boolean
    Returns whether the constraint is PRIMARY KEY.
    boolean
     
    boolean
    Returns whether the constraint is UNIQUE.
    void
    unparse(org.apache.calcite.sql.SqlWriter writer, int leftPrec, int rightPrec)
     

    Methods inherited from class org.apache.calcite.sql.SqlCall

    accept, clone, equalsDeep, findValidOptions, getCallSignature, getFunctionQuantifier, getKind, getMonotonicity, isCountStar, isExpanded, operand, operandCount, setOperand, validate

    Methods inherited from class org.apache.calcite.sql.SqlNode

    clone, clone, cloneArray, equalDeep, equalDeep, equalsDeep, getParserPosition, isA, toList, toList, toSqlString, toSqlString, toSqlString, toString, unparseWithParentheses, validateExpr

    Methods inherited from class java.lang.Object

    equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • SqlTableConstraint

      public SqlTableConstraint(@Nullable org.apache.calcite.sql.SqlIdentifier constraintName, org.apache.calcite.sql.SqlLiteral uniqueSpec, org.apache.calcite.sql.SqlNodeList columns, @Nullable org.apache.calcite.sql.SqlLiteral enforcement, boolean isTableConstraint, org.apache.calcite.sql.parser.SqlParserPos pos)
      Creates a table constraint node.
      Parameters:
      constraintName - Constraint name
      uniqueSpec - Unique specification
      columns - Column list on which the constraint enforces or null if this is a column constraint
      enforcement - Whether the constraint is enforced
      isTableConstraint - Whether this is a table constraint
      pos - Parser position
  • Method Details

    • getOperator

      public org.apache.calcite.sql.SqlOperator getOperator()
      Specified by:
      getOperator in class org.apache.calcite.sql.SqlCall
    • isUnique

      public boolean isUnique()
      Returns whether the constraint is UNIQUE.
    • isPrimaryKey

      public boolean isPrimaryKey()
      Returns whether the constraint is PRIMARY KEY.
    • isEnforced

      public boolean isEnforced()
      Returns whether the constraint is enforced.
    • getConstraintName

      public Optional<String> getConstraintName()
    • getConstraintNameIdentifier

      public Optional<org.apache.calcite.sql.SqlIdentifier> getConstraintNameIdentifier()
    • getColumns

      public org.apache.calcite.sql.SqlNodeList getColumns()
    • isTableConstraint

      public boolean isTableConstraint()
    • getColumnNames

      public String[] getColumnNames()
      Returns the columns as a string array.
    • getOperandList

      public List<org.apache.calcite.sql.SqlNode> getOperandList()
      Specified by:
      getOperandList in class org.apache.calcite.sql.SqlCall
    • unparse

      public void unparse(org.apache.calcite.sql.SqlWriter writer, int leftPrec, int rightPrec)
      Overrides:
      unparse in class org.apache.calcite.sql.SqlCall