public EnumSet<TableAttribute> diff(HCatTable rhs, EnumSet<TableAttribute> attributesToCheck) {
    EnumSet<TableAttribute> theDiff = EnumSet.noneOf(TableAttribute.class);

    for (TableAttribute attribute : attributesToCheck) {

      if (attribute.equals(TableAttribute.COLUMNS)) {
        if (!rhs.getCols().containsAll(getCols()) ||
            !getCols().containsAll(rhs.getCols())) {
          theDiff.add(TableAttribute.COLUMNS);
        }
      }

      if (attribute.equals(TableAttribute.INPUT_FORMAT)) {
        if ((getInputFileFormat() == null && rhs.getInputFileFormat() != null)
            || (getInputFileFormat() != null && (rhs.getInputFileFormat() == null || !rhs.getInputFileFormat().equals(getInputFileFormat())))) {
          theDiff.add(TableAttribute.INPUT_FORMAT);
        }
      }

      if (attribute.equals(TableAttribute.OUTPUT_FORMAT)) {
        if ((getOutputFileFormat() == null && rhs.getOutputFileFormat() != null)
          || (getOutputFileFormat() != null && (rhs.getOutputFileFormat() == null || !rhs.getOutputFileFormat().equals(getOutputFileFormat())))) {
          theDiff.add(TableAttribute.OUTPUT_FORMAT);
        }
      }

      if (attribute.equals(TableAttribute.STORAGE_HANDLER)) {
        if ((getStorageHandler() == null && rhs.getStorageHandler() != null)
            || (getStorageHandler() != null && (rhs.getStorageHandler() == null || !rhs.getStorageHandler().equals(getStorageHandler())))) {
          theDiff.add(TableAttribute.STORAGE_HANDLER);
        }
      }

      if (attribute.equals(TableAttribute.SERDE)) {
        if ((getSerdeLib() == null && rhs.getSerdeLib() != null)
            || (getSerdeLib() != null && (rhs.getSerdeLib() == null || !rhs.getSerdeLib().equals(getSerdeLib())))) {
          theDiff.add(TableAttribute.SERDE);
        }
      }

      if (attribute.equals(TableAttribute.SERDE_PROPERTIES)) {
        if (!equivalent(sd.getSerdeInfo().getParameters(), rhs.sd.getSerdeInfo().getParameters())) {
          theDiff.add(TableAttribute.SERDE_PROPERTIES);
        }
      }

      if (attribute.equals(TableAttribute.TABLE_PROPERTIES)) {
        if (!equivalent(tblProps, rhs.tblProps)) {
          theDiff.add(TableAttribute.TABLE_PROPERTIES);
        }
      }

    }

    return theDiff;
  }
Method to compare the attributes of 2 HCatTable instances.
@param rhs The other table being compared against. Can't be null.
@param attributesToCheck The list of TableAttributes being compared.
@return {@code EnumSet<TableAttribute>} containing all the attribute that differ between {@code this} and rhs.
Subset of {@code attributesToCheck}.
hcatalog/webhcat/java-client/src/main/java/org/apache/hive/hcatalog/api/HCatTable.java