private List<DatasetVersionRecord> executeListValidDatasetVersionsByListStatement(PreparedStatement statement,
      int accountId, int containerId, String datasetName, Dataset.VersionSchema versionSchema) throws SQLException {
    ResultSet resultSet = null;
    try {
      statement.setInt(1, accountId);
      statement.setInt(2, containerId);
      statement.setString(3, datasetName);
      statement.setInt(4, DatasetVersionState.READY.ordinal());
      resultSet = statement.executeQuery();
      List<DatasetVersionRecord> entries = new ArrayList<>();
      while (resultSet.next()) {
        long versionValue = resultSet.getLong(VERSION);
        long expirationTimeMs = timestampToMs(resultSet.getTimestamp(DELETED_TS));
        long creationTimeMs = timestampToMs(resultSet.getTimestamp(CREATION_TIME));
        String rename_from = resultSet.getString(RENAME_FROM);
        String version = convertVersionValueToVersion(versionValue, versionSchema);
        entries.add(
            new DatasetVersionRecord(accountId, containerId, datasetName, version, expirationTimeMs, creationTimeMs,
                rename_from));
      }
      return entries;
    } finally {
      closeQuietly(resultSet);
    }
  }
Execute listValidDatasetVersionsByListSql statement.
@param statement the listValidDatasetVersionsByListSql statement.
@param accountId the id for the parent account.
@param containerId the id of the container.
@param datasetName the name of the dataset.
@param versionSchema the version schema of the dataset.
@return the list of all valid dataset versions under a dataset.
@throws SQLException
ambry-account/src/main/java/com/github/ambry/account/mysql/DatasetDao.java