private List<DatasetVersionRecord> executeListAllValidVersionForDatasetDeletionStatement(PreparedStatement statement,
      int accountId, int containerId, String datasetName, Dataset.VersionSchema versionSchema) throws SQLException {
    ResultSet resultSet = null;
    List<DatasetVersionRecord> datasetVersionRecords = new ArrayList<>();
    try {
      statement.setInt(1, accountId);
      statement.setInt(2, containerId);
      statement.setString(3, datasetName);
      resultSet = statement.executeQuery();
      while (resultSet.next()) {
        long versionValue = resultSet.getLong(VERSION);
        String version = convertVersionValueToVersion(versionValue, versionSchema);
        String renameFrom = resultSet.getString(RENAME_FROM);
        Timestamp deletionTime = resultSet.getTimestamp(DELETED_TS);
        DatasetVersionRecord datasetVersionRecord =
            new DatasetVersionRecord(accountId, containerId, datasetName, version, timestampToMs(deletionTime),
                renameFrom);
        datasetVersionRecords.add(datasetVersionRecord);
      }
      return datasetVersionRecords;
    } finally {
      closeQuietly(resultSet);
    }
  }
Execute listValidVersionSql statement.
@param statement the statement to list all dataset versions which is not expired or been deleted which belongs to
the related dataset.
@param accountId the id for the parent account.
@param containerId the id of the container.
@param datasetName the name of the dataset.
@return a list of all dataset versions which is not expired or been deleted which belongs to the related dataset.
@throws SQLException
ambry-account/src/main/java/com/github/ambry/account/mysql/DatasetDao.java