use of org.apache.hadoop.hive.ql.metadata.CheckConstraint.CheckConstraintCol in project hive by apache.
the class TextDescTableFormatter method getCheckConstraintRelInformation.
private void getCheckConstraintRelInformation(StringBuilder constraintsInfo, String constraintName, List<CheckConstraintCol> columns) {
formatOutput("Constraint Name:", constraintName, constraintsInfo);
if (CollectionUtils.isNotEmpty(columns)) {
for (CheckConstraintCol column : columns) {
String[] fields = new String[2];
fields[0] = "Column Name:" + column.getColName();
fields[1] = "Check Value:" + column.getCheckExpression();
formatOutput(fields, constraintsInfo);
}
}
constraintsInfo.append(LINE_DELIM);
}
use of org.apache.hadoop.hive.ql.metadata.CheckConstraint.CheckConstraintCol in project hive by apache.
the class DDLPlanUtils method getAlterTableStmtCheckConstraint.
public void getAlterTableStmtCheckConstraint(CheckConstraint ck, List<String> constraints) {
if (!CheckConstraint.isNotEmpty(ck)) {
return;
}
Map<String, List<CheckConstraint.CheckConstraintCol>> checkConstraints = ck.getCheckConstraints();
for (String constraintName : checkConstraints.keySet()) {
List<CheckConstraintCol> checkConstraintCols = checkConstraints.get(constraintName);
if (checkConstraintCols != null && checkConstraintCols.size() > 0) {
for (CheckConstraintCol col : checkConstraintCols) {
ST command = new ST(ALTER_TABLE_ADD_CHECK_CONSTRAINT);
command.add(DATABASE_NAME, ck.getDatabaseName());
command.add(TABLE_NAME, ck.getTableName());
command.add(CONSTRAINT_NAME, constraintName);
command.add(CHECK_EXPRESSION, col.getCheckExpression());
command.add(ENABLE, col.getEnable());
command.add(VALIDATE, col.getValidate());
command.add(RELY, col.getRely());
constraints.add(command.render());
}
}
}
}
Aggregations