Skip to content

Conversation

@pongad
Copy link
Contributor

@pongad pongad commented Feb 9, 2018

If we create a job with randomly generated ID, it's highly unlikely
that it will with another job created by someone else.
When create fails, it is possible that the job was created successfully
anyway.
Thus, we can be more failure-tolerant by trying to retrieve the job,
if create throws.

Fixes #2867.

If we create a job with randomly generated ID, it's highly unlikely
that it will with another job created by someone else.
When create fails, it is possible that the job was created successfully
anyway.
Thus, we can be more failure-tolerant by trying to retrieve the job,
if create throws.

Fixes #2867.
@pongad pongad requested review from tswast and vam-google February 9, 2018 06:51
@googlebot googlebot added the cla: yes This human has signed the Contributor License Agreement. label Feb 9, 2018
}

@Test
public void testCreateQueryJob() {

This comment was marked as spam.

Copy link
Contributor

@tswast tswast left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! Looking great. A few nits / questions.

public TableResult query(QueryJobConfiguration configuration, JobOption... options)
throws InterruptedException, JobException {
return query(configuration, JobId.of(), options);
Job.checkNotDryRun(configuration, "query");

This comment was marked as spam.

This comment was marked as spam.

try {
return getJob(jobInfo.getJobId());
} catch (BigQueryException e) {
System.err.println("rethrow");

This comment was marked as spam.

bigqueryRpcMock.create(
JobInfo.of(LOAD_JOB_CONFIGURATION_WITH_PROJECT).toPb(), EMPTY_RPC_OPTIONS))
.andReturn(COMPLETE_LOAD_JOB.toPb());
bigqueryRpcMock.create(EasyMock.capture(jobCapture), EasyMock.eq(EMPTY_RPC_OPTIONS)))

This comment was marked as spam.

bigquery = options.getService();
Job job = bigquery.create(COPY_JOB);
assertEquals(new Job(bigquery, new JobInfo.BuilderImpl(COMPLETE_COPY_JOB)), job);
Job job = bigquery.create(QUERY_JOB, JOB_OPTION_FIELDS);

This comment was marked as spam.

String selector = (String) capturedOptions.getValue().get(JOB_OPTION_FIELDS.getRpcOption());
assertThat(selector.split(","))
.asList()
.containsExactly("jobReference", "configuration", "user_email");

This comment was marked as spam.

This comment was marked as spam.

new Supplier<JobId>() {
@Override
public JobId get() {
return JobId.of();

This comment was marked as spam.

This comment was marked as spam.

This comment was marked as spam.

This comment was marked as spam.

This comment was marked as spam.

@pongad
Copy link
Contributor Author

pongad commented Feb 12, 2018

@tswast PTAL

Copy link
Contributor

@tswast tswast left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM once Circle is happy

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cla: yes This human has signed the Contributor License Agreement.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants