Skip to content

Commit

Permalink
fixup! Minor Fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Mark Liu committed Dec 6, 2016
1 parent 23edcfc commit a8f7365
Showing 1 changed file with 11 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -124,13 +124,13 @@ protected boolean matchesSafely(PipelineResult pipelineResult) {
if (!response.getJobComplete()) {
// query job not complete, verification failed
return false;
}

// compute checksum
actualChecksum = generateHash(response.getRows());
LOG.debug("Generated a SHA1 checksum based on queried data: {}", actualChecksum);
} else {
// compute checksum
actualChecksum = generateHash(response.getRows());
LOG.debug("Generated a SHA1 checksum based on queried data: {}", actualChecksum);

return expectedChecksum.equals(actualChecksum);
return expectedChecksum.equals(actualChecksum);
}
}

@VisibleForTesting
Expand All @@ -150,12 +150,15 @@ QueryResponse queryWithRetries(Bigquery bigqueryClient, QueryRequest queryConten
Sleeper sleeper, BackOff backOff)
throws IOException, InterruptedException {
QueryResponse response;
IOException lastException = null;
IOException lastException;
do {
try {
response = bigqueryClient.jobs().query(projectId, queryContent).execute();
if (response != null) {
return response;
} else {
lastException =
new IOException("Expected valid response from query job, but received null.");
}
} catch (IOException e) {
// ignore and retry
Expand All @@ -166,8 +169,7 @@ QueryResponse queryWithRetries(Bigquery bigqueryClient, QueryRequest queryConten

throw new RuntimeException(
String.format(
"Unable to get BigQuery response after retrying %d times. Got response: null.",
MAX_QUERY_RETRIES),
"Unable to get BigQuery response after retrying %d times.", MAX_QUERY_RETRIES),
lastException);
}

Expand Down

0 comments on commit a8f7365

Please sign in to comment.