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

feat(bigquery): explicitly ask for dense responses from HTTP backend #739

Merged
merged 1 commit into from Sep 17, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -120,6 +120,7 @@ public Dataset getDataset(String projectId, String datasetId, Map<Option, ?> opt
.datasets()
.get(projectId, datasetId)
.setFields(Option.FIELDS.getString(options))
.setPrettyPrint(false)
.execute();
} catch (IOException ex) {
BigQueryException serviceException = translate(ex);
Expand All @@ -137,6 +138,7 @@ public Tuple<String, Iterable<Dataset>> listDatasets(String projectId, Map<Optio
bigquery
.datasets()
.list(projectId)
.setPrettyPrint(false)
.setAll(Option.ALL_DATASETS.getBoolean(options))
.setFilter(Option.LABEL_FILTER.getString(options))
.setMaxResults(Option.MAX_RESULTS.getLong(options))
Expand All @@ -160,6 +162,7 @@ public Dataset create(Dataset dataset, Map<Option, ?> options) {
return bigquery
.datasets()
.insert(dataset.getDatasetReference().getProjectId(), dataset)
.setPrettyPrint(false)
.setFields(Option.FIELDS.getString(options))
.execute();
} catch (IOException ex) {
Expand All @@ -176,6 +179,7 @@ public Table create(Table table, Map<Option, ?> options) {
return bigquery
.tables()
.insert(reference.getProjectId(), reference.getDatasetId(), table)
.setPrettyPrint(false)
.setFields(Option.FIELDS.getString(options))
.execute();
} catch (IOException ex) {
Expand All @@ -190,6 +194,7 @@ public Routine create(Routine routine, Map<Option, ?> options) {
return bigquery
.routines()
.insert(reference.getProjectId(), reference.getDatasetId(), routine)
.setPrettyPrint(false)
.setFields(Option.FIELDS.getString(options))
.execute();
} catch (IOException ex) {
Expand All @@ -207,6 +212,7 @@ public Job create(Job job, Map<Option, ?> options) {
return bigquery
.jobs()
.insert(projectId, job)
.setPrettyPrint(false)
.setFields(Option.FIELDS.getString(options))
.execute();
} catch (IOException ex) {
Expand All @@ -220,6 +226,7 @@ public boolean deleteDataset(String projectId, String datasetId, Map<Option, ?>
bigquery
.datasets()
.delete(projectId, datasetId)
.setPrettyPrint(false)
.setDeleteContents(Option.DELETE_CONTENTS.getBoolean(options))
.execute();
return true;
Expand All @@ -239,6 +246,7 @@ public Dataset patch(Dataset dataset, Map<Option, ?> options) {
return bigquery
.datasets()
.patch(reference.getProjectId(), reference.getDatasetId(), dataset)
.setPrettyPrint(false)
.setFields(Option.FIELDS.getString(options))
.execute();
} catch (IOException ex) {
Expand All @@ -255,6 +263,7 @@ public Table patch(Table table, Map<Option, ?> options) {
return bigquery
.tables()
.patch(reference.getProjectId(), reference.getDatasetId(), reference.getTableId(), table)
.setPrettyPrint(false)
.setFields(Option.FIELDS.getString(options))
.execute();
} catch (IOException ex) {
Expand All @@ -269,6 +278,7 @@ public Table getTable(
return bigquery
.tables()
.get(projectId, datasetId, tableId)
.setPrettyPrint(false)
.setFields(Option.FIELDS.getString(options))
.execute();
} catch (IOException ex) {
Expand All @@ -288,6 +298,7 @@ public Tuple<String, Iterable<Table>> listTables(
bigquery
.tables()
.list(projectId, datasetId)
.setPrettyPrint(false)
.setMaxResults(Option.MAX_RESULTS.getLong(options))
.setPageToken(Option.PAGE_TOKEN.getString(options))
.execute();
Expand Down Expand Up @@ -337,6 +348,7 @@ public Model patch(Model model, Map<Option, ?> options) {
return bigquery
.models()
.patch(reference.getProjectId(), reference.getDatasetId(), reference.getModelId(), model)
.setPrettyPrint(false)
.setFields(Option.FIELDS.getString(options))
.execute();
} catch (IOException ex) {
Expand All @@ -351,6 +363,7 @@ public Model getModel(
return bigquery
.models()
.get(projectId, datasetId, modelId)
.setPrettyPrint(false)
.setFields(Option.FIELDS.getString(options))
.execute();
} catch (IOException ex) {
Expand All @@ -370,6 +383,7 @@ public Tuple<String, Iterable<Model>> listModels(
bigquery
.models()
.list(projectId, datasetId)
.setPrettyPrint(false)
.setMaxResults(Option.MAX_RESULTS.getLong(options))
.setPageToken(Option.PAGE_TOKEN.getString(options))
.execute();
Expand Down Expand Up @@ -402,6 +416,7 @@ public Routine update(Routine routine, Map<Option, ?> options) {
.routines()
.update(
reference.getProjectId(), reference.getDatasetId(), reference.getRoutineId(), routine)
.setPrettyPrint(false)
.setFields(Option.FIELDS.getString(options))
.execute();
} catch (IOException ex) {
Expand All @@ -416,6 +431,7 @@ public Routine getRoutine(
return bigquery
.routines()
.get(projectId, datasetId, routineId)
.setPrettyPrint(false)
.setFields(Option.FIELDS.getString(options))
.execute();
} catch (IOException ex) {
Expand All @@ -435,6 +451,7 @@ public Tuple<String, Iterable<Routine>> listRoutines(
bigquery
.routines()
.list(projectId, datasetId)
.setPrettyPrint(false)
.setMaxResults(Option.MAX_RESULTS.getLong(options))
.setPageToken(Option.PAGE_TOKEN.getString(options))
.execute();
Expand Down Expand Up @@ -463,7 +480,11 @@ public boolean deleteRoutine(String projectId, String datasetId, String routineI
public TableDataInsertAllResponse insertAll(
String projectId, String datasetId, String tableId, TableDataInsertAllRequest request) {
try {
return bigquery.tabledata().insertAll(projectId, datasetId, tableId, request).execute();
return bigquery
.tabledata()
.insertAll(projectId, datasetId, tableId, request)
.setPrettyPrint(false)
.execute();
} catch (IOException ex) {
throw translate(ex);
}
Expand All @@ -476,6 +497,7 @@ public TableDataList listTableData(
return bigquery
.tabledata()
.list(projectId, datasetId, tableId)
.setPrettyPrint(false)
.setMaxResults(Option.MAX_RESULTS.getLong(options))
.setPageToken(Option.PAGE_TOKEN.getString(options))
.setStartIndex(
Expand All @@ -494,6 +516,7 @@ public Job getJob(String projectId, String jobId, String location, Map<Option, ?
return bigquery
.jobs()
.get(projectId, jobId)
.setPrettyPrint(false)
.setLocation(location)
.setFields(Option.FIELDS.getString(options))
.execute();
Expand All @@ -513,6 +536,7 @@ public Tuple<String, Iterable<Job>> listJobs(String projectId, Map<Option, ?> op
bigquery
.jobs()
.list(projectId)
.setPrettyPrint(false)
.setAllUsers(Option.ALL_USERS.getBoolean(options))
.setFields(Option.FIELDS.getString(options))
.setStateFilter(Option.STATE_FILTER.<List<String>>get(options))
Expand Down Expand Up @@ -562,7 +586,12 @@ public Job apply(JobList.Jobs jobPb) {
@Override
public boolean cancel(String projectId, String jobId, String location) {
try {
bigquery.jobs().cancel(projectId, jobId).setLocation(location).execute();
bigquery
.jobs()
.cancel(projectId, jobId)
.setLocation(location)
.setPrettyPrint(false)
.execute();
return true;
} catch (IOException ex) {
BigQueryException serviceException = translate(ex);
Expand All @@ -580,6 +609,7 @@ public GetQueryResultsResponse getQueryResults(
return bigquery
.jobs()
.getQueryResults(projectId, jobId)
.setPrettyPrint(false)
.setLocation(location)
.setMaxResults(Option.MAX_RESULTS.getLong(options))
.setPageToken(Option.PAGE_TOKEN.getString(options))
Expand Down Expand Up @@ -676,7 +706,11 @@ public Policy getIamPolicy(String resourceId, Map<Option, ?> options) {
.setRequestedPolicyVersion(
Option.REQUESTED_POLICY_VERSION.getLong(options).intValue()));
}
return bigquery.tables().getIamPolicy(resourceId, policyRequest).execute();
return bigquery
.tables()
.getIamPolicy(resourceId, policyRequest)
.setPrettyPrint(false)
.execute();
} catch (IOException ex) {
throw translate(ex);
}
Expand All @@ -686,7 +720,11 @@ public Policy getIamPolicy(String resourceId, Map<Option, ?> options) {
public Policy setIamPolicy(String resourceId, Policy policy, Map<Option, ?> options) {
try {
SetIamPolicyRequest policyRequest = new SetIamPolicyRequest().setPolicy(policy);
return bigquery.tables().setIamPolicy(resourceId, policyRequest).execute();
return bigquery
.tables()
.setIamPolicy(resourceId, policyRequest)
.setPrettyPrint(false)
.execute();
} catch (IOException ex) {
throw translate(ex);
}
Expand All @@ -698,7 +736,11 @@ public TestIamPermissionsResponse testIamPermissions(
try {
TestIamPermissionsRequest permissionsRequest =
new TestIamPermissionsRequest().setPermissions(permissions);
return bigquery.tables().testIamPermissions(resourceId, permissionsRequest).execute();
return bigquery
.tables()
.testIamPermissions(resourceId, permissionsRequest)
.setPrettyPrint(false)
.execute();
} catch (IOException ex) {
throw translate(ex);
}
Expand Down