Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Increase the default page size for listing BigQuery schemas and tables #22037

Merged
merged 1 commit into from
May 21, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@
public class BigQueryClient
{
private static final Logger log = Logger.get(BigQueryClient.class);
private static final int PAGE_SIZE = 100;

static final Set<TableDefinition.Type> TABLE_TYPES = ImmutableSet.of(TABLE, VIEW, MATERIALIZED_VIEW, EXTERNAL, SNAPSHOT);

Expand Down Expand Up @@ -253,7 +254,7 @@ public Iterable<DatasetId> listDatasetIds(String projectId)
private List<DatasetId> listDatasetIdsFromBigQuery(String projectId)
{
// BigQuery.listDatasets returns partial information on each dataset. See javadoc for more details.
return stream(bigQuery.listDatasets(projectId).iterateAll())
return stream(bigQuery.listDatasets(projectId, BigQuery.DatasetListOption.pageSize(PAGE_SIZE)).iterateAll())
.map(Dataset::getDatasetId)
.collect(toImmutableList());
}
Expand All @@ -263,7 +264,7 @@ public Iterable<TableId> listTableIds(DatasetId remoteDatasetId)
// BigQuery.listTables returns partial information on each table. See javadoc for more details.
Iterable<Table> allTables;
try {
allTables = bigQuery.listTables(remoteDatasetId).iterateAll();
allTables = bigQuery.listTables(remoteDatasetId, BigQuery.TableListOption.pageSize(PAGE_SIZE)).iterateAll();
}
catch (BigQueryException e) {
throw new TrinoException(BIGQUERY_LISTING_TABLE_ERROR, "Failed to retrieve tables from BigQuery", e);
Expand Down