private String getConstraintsInformation(Table table) {
    StringBuilder constraintsInfo = new StringBuilder(DEFAULT_STRINGBUILDER_SIZE);

    constraintsInfo.append(LINE_DELIM).append("# Constraints").append(LINE_DELIM);
    if (PrimaryKeyInfo.isNotEmpty(table.getPrimaryKeyInfo())) {
      constraintsInfo.append(LINE_DELIM).append("# Primary Key").append(LINE_DELIM);
      getPrimaryKeyInformation(constraintsInfo, table.getPrimaryKeyInfo());
    }
    if (ForeignKeyInfo.isNotEmpty(table.getForeignKeyInfo())) {
      constraintsInfo.append(LINE_DELIM).append("# Foreign Keys").append(LINE_DELIM);
      getForeignKeysInformation(constraintsInfo, table.getForeignKeyInfo());
    }
    if (UniqueConstraint.isNotEmpty(table.getUniqueKeyInfo())) {
      constraintsInfo.append(LINE_DELIM).append("# Unique Constraints").append(LINE_DELIM);
      getUniqueConstraintsInformation(constraintsInfo, table.getUniqueKeyInfo());
    }
    if (NotNullConstraint.isNotEmpty(table.getNotNullConstraint())) {
      constraintsInfo.append(LINE_DELIM).append("# Not Null Constraints").append(LINE_DELIM);
      getNotNullConstraintsInformation(constraintsInfo, table.getNotNullConstraint());
    }
    if (DefaultConstraint.isNotEmpty(table.getDefaultConstraint())) {
      constraintsInfo.append(LINE_DELIM).append("# Default Constraints").append(LINE_DELIM);
      getDefaultConstraintsInformation(constraintsInfo, table.getDefaultConstraint());
    }
    if (CheckConstraint.isNotEmpty(table.getCheckConstraint())) {
      constraintsInfo.append(LINE_DELIM).append("# Check Constraints").append(LINE_DELIM);
      getCheckConstraintsInformation(constraintsInfo, table.getCheckConstraint());
    }
    return constraintsInfo.toString();
  }
Formats DESC TABLE results to text format.
ql/src/java/org/apache/hadoop/hive/ql/ddl/table/info/desc/formatter/TextDescTableFormatter.java