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
-
-
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
All Methods Instance Methods Concrete Methods Modifier and Type Method Description String[]
getColumnNames()
Returns the columns as a string array.org.apache.calcite.sql.SqlNodeList
getColumns()
Optional<String>
getConstraintName()
Optional<org.apache.calcite.sql.SqlIdentifier>
getConstraintNameIdentifier()
List<org.apache.calcite.sql.SqlNode>
getOperandList()
org.apache.calcite.sql.SqlOperator
getOperator()
boolean
isEnforced()
Returns whether the constraint is enforced.boolean
isPrimaryKey()
Returns whether the constraint is PRIMARY KEY.boolean
isTableConstraint()
boolean
isUnique()
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
-
-
-
-
Constructor Detail
-
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 nameuniqueSpec
- Unique specificationcolumns
- Column list on which the constraint enforces or null if this is a column constraintenforcement
- Whether the constraint is enforcedisTableConstraint
- Whether this is a table constraintpos
- Parser position
-
-
Method Detail
-
getOperator
public org.apache.calcite.sql.SqlOperator getOperator()
- Specified by:
getOperator
in classorg.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.
-
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 classorg.apache.calcite.sql.SqlCall
-
unparse
public void unparse(org.apache.calcite.sql.SqlWriter writer, int leftPrec, int rightPrec)
- Overrides:
unparse
in classorg.apache.calcite.sql.SqlCall
-
-