Skip to content

BigQuery::listDatasets API response does not populate Dataset::location field #3237

@sumeetgajjar

Description

@sumeetgajjar

Steps to reproduce

  1. Invoke BigQuery::listDatasets
  2. Invoking Dataset::getLocation on the response shall return null

Code example

String projectId = "bigquery-public-data";
FileInputStream stream = new FileInputStream(<creds json path>);

BigQuery bigquery =
    BigQueryOptions.newBuilder()
        .setCredentials(ServiceAccountCredentials.fromStream(stream))
        .build()
        .getService();

Page<Dataset> page = bigquery.listDatasets(projectId);
for (Dataset dataset : page.iterateAll()) {
  assertThat(dataset.getLocation()).isNull();
}

Any additional information below

  • The field is available in the com.google.api.services.bigquery.model.Dataset#location however, it is not mapped to com.google.cloud.bigquery.Dataset#location by HttpBigQueryRpc#LIST_TO_DATASET`

https://github.com/googleapis/google-api-java-client-services/blob/9ab9bf5d1cb81e24c33dfd824fd5645305e0d108/clients/google-api-services-bigquery/v2/2.0.0/com/google/api/services/bigquery/model/Dataset.java#L211-L217

@InternalApi("Visible for testing")
static final Function<DatasetList.Datasets, Dataset> LIST_TO_DATASET =
new Function<DatasetList.Datasets, Dataset>() {
@Override
public Dataset apply(DatasetList.Datasets datasetPb) {
return new Dataset()
.setDatasetReference(datasetPb.getDatasetReference())
.setFriendlyName(datasetPb.getFriendlyName())
.setId(datasetPb.getId())
.setKind(datasetPb.getKind())
.setLabels(datasetPb.getLabels());
}
};

Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    api: bigqueryIssues related to the googleapis/java-bigquery API.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions