private DatasetVersionRecord executeGetDatasetVersionStatement(PreparedStatement statement, short accountId,
      short containerId, String datasetName, long versionValue, String version)
      throws SQLException, AccountServiceException {
    ResultSet resultSet = null;
    Timestamp deletionTime;
    String renameFrom;
    try {
      statement.setInt(1, accountId);
      statement.setInt(2, containerId);
      statement.setString(3, datasetName);
      statement.setLong(4, versionValue);
      statement.setInt(5, DatasetVersionState.READY.ordinal());
      resultSet = statement.executeQuery();
      if (!resultSet.next()) {
        throw new AccountServiceException(
            "Dataset version not found for account: " + accountId + " container: " + containerId + " dataset: "
                + datasetName + " version: " + version, AccountServiceErrorCode.NotFound);
      }
      renameFrom = resultSet.getString(RENAME_FROM);
      deletionTime = resultSet.getTimestamp(DELETED_TS);
      long currentTime = System.currentTimeMillis();
      if (compareTimestamp(deletionTime, currentTime) <= 0) {
        throw new AccountServiceException(
            "Dataset version expired for account: " + accountId + " container: " + containerId + " dataset: "
                + datasetName + " version: " + version, AccountServiceErrorCode.Deleted);
      }
    } finally {
      closeQuietly(resultSet);
    }
    return new DatasetVersionRecord(accountId, containerId, datasetName, version, timestampToMs(deletionTime),
        renameFrom);
  }
Execute the get dataset version statement to get the dataset version.
@param statement the mysql statement to get dataset version.
@param accountId the id for the parent account.
@param containerId the id of the container.
@param datasetName the name of the dataset.
@param versionValue the version long value of the dataset.
@param version the String type version of the dataset.
@return the {@link DatasetVersionRecord}
@throws SQLException
ambry-account/src/main/java/com/github/ambry/account/mysql/DatasetDao.java