public DatasetVersionRecord getDatasetVersions(short accountId, short containerId, String accountName,
      String containerName, String datasetName, String version) throws SQLException, AccountServiceException {
    try {
      long startTimeMs = System.currentTimeMillis();
      //if dataset is deleted, we should not be able to get any dataset version.
      Dataset dataset;
      Dataset.VersionSchema versionSchema;
      long versionValue;
      DatasetVersionRecord result;
      if (isAutoCreatedVersionForDownload(version)) {
        dataset = getDatasetHelper(accountId, containerId, accountName, containerName, datasetName, true);
        versionSchema = dataset.getVersionSchema();
        PreparedStatement getLatestVersionStatement =
            dataAccessor.getPreparedStatement(getLatestVersionSqlForDownload, true);
        result =
            executeGetLatestVersionStatementForDownload(getLatestVersionStatement, accountId, containerId, datasetName,
                versionSchema);
      } else {
        dataset = getDatasetHelper(accountId, containerId, accountName, containerName, datasetName, false);
        versionSchema = dataset.getVersionSchema();
        PreparedStatement getDatasetVersionStatement =
            dataAccessor.getPreparedStatement(getDatasetVersionByNameSql, false);
        versionValue = getVersionBasedOnSchema(version, versionSchema);
        result = executeGetDatasetVersionStatement(getDatasetVersionStatement, accountId, containerId, datasetName,
            versionValue, version);
      }
      dataAccessor.onSuccess(Read, System.currentTimeMillis() - startTimeMs);
      return result;
    } catch (SQLException | AccountServiceException e) {
      dataAccessor.onException(e, Read);
      throw e;
    }
  }
Get a version of {@link Dataset} based on supplied properties.
@param accountId the id for the parent account.
@param containerId the id of the container.
@param accountName the name for the parent account.
@param containerName the name for the container.
@param datasetName the name of the dataset.
@param version the version of the dataset.
@return the {@link DatasetVersionRecord}
@throws SQLException
ambry-account/src/main/java/com/github/ambry/account/mysql/DatasetDao.java