class TableDiff {

  public static TableMetadata diffMetadata(TableMetadata inputMetadata) {
    ImmutableList.Builder<ColumnMetadata> diffColumnMetatadata = ImmutableList.builder();
    // 1. Insert all key columns
    for (ColumnMetadata cm : inputMetadata.getColumnMetadata()) {
      if (cm.getIsKey()) {
        diffColumnMetatadata.add(
            new ColumnMetadata(cm.getName(), cm.getSchema(), cm.getDescription(), true, false));
      }
    }
    String dhintText =
        "["
            + diffColumnMetatadata.build().stream()
                .map(ColumnMetadata::getName)
                .collect(Collectors.joining(", "))
            + "]";

    // 2. Insert the key status column
    diffColumnMetatadata.add(
        new ColumnMetadata(COL_KEY_PRESENCE, Schema.STRING, COL_KEY_PRESENCE_DESC, false, true));

    // 3. Add other columns
    for (ColumnMetadata cm : inputMetadata.getColumnMetadata()) {
      if (cm.getIsKey()) {
        continue;
      }
      diffColumnMetatadata.add(
          new ColumnMetadata(
              baseColumnName(cm.getName()), cm.getSchema(), cm.getDescription(), false, false),
          new ColumnMetadata(
              deltaColumnName(cm.getName()), cm.getSchema(), cm.getDescription(), false, false));
    }

    return new TableMetadata(diffColumnMetatadata.build(), dhintText);
  }

  private  TableDiff();

}