private int executeUpdateDatasetStatement(PreparedStatement statement, int accountId, int containerId,
      Dataset dataset) throws SQLException, AccountServiceException {
    Dataset.VersionSchema versionSchema = dataset.getVersionSchema();
    if (versionSchema != null) {
      throw new AccountServiceException("version Schema can't be updated once the dataset has been created",
          AccountServiceErrorCode.BadRequest);
    }
    Map<String, String> userTags = dataset.getUserTags();
    String userTagsInJson = null;
    if (userTags != null) {
      try {
        userTagsInJson = objectMapper.writeValueAsString(userTags);
      } catch (IOException e) {
        throw new AccountServiceException("Fail to serialize user tags : " + userTags,
            AccountServiceErrorCode.BadRequest);
      }
    }
    String retentionPolicy = dataset.getRetentionPolicy();
    if (retentionPolicy != null) {
      statement.setString(1, retentionPolicy);
    } else {
      //For update, do not set DEFAULT_RETENTION_POLICY as default.
      statement.setString(1, null);
    }
    Integer retentionCount = dataset.getRetentionCount();
    if (retentionCount != null) {
      statement.setInt(2, retentionCount);
    } else {
      statement.setObject(2, null);
    }
    Long retentionTimeInSeconds = dataset.getRetentionTimeInSeconds();
    if (retentionTimeInSeconds != null) {
      statement.setLong(3, retentionTimeInSeconds);
    } else {
      statement.setObject(3, null);
    }
    statement.setString(4, userTagsInJson);
    statement.setInt(5, accountId);
    statement.setInt(6, containerId);
    statement.setString(7, dataset.getDatasetName());
    return statement.executeUpdate();
  }
Execute updateDatasetStatement to update Dataset.
@param statement the mysql statement to update dataset.
@param accountId the id for the parent account.
@param containerId the id of the container.
@param dataset the {@link Dataset}
@return the number of rows been updated.
@throws SQLException
ambry-account/src/main/java/com/github/ambry/account/mysql/DatasetDao.java