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

Adding BigQuery integration test for query dry runs #2328

Merged
merged 1 commit into from
Aug 10, 2017
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 @@ -16,6 +16,7 @@

package com.google.cloud.bigquery.it;

import static com.google.cloud.bigquery.JobStatus.State.DONE;
import static org.junit.Assert.assertArrayEquals;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
Expand Down Expand Up @@ -1067,6 +1068,26 @@ public void testQueryJob() throws InterruptedException, TimeoutException {
assertNotNull(statistics.getQueryPlan());
}

@Test
public void testQueryJobWithDryRun() throws InterruptedException, TimeoutException {
String tableName = "test_query_job_table";
String query = new StringBuilder()
.append("SELECT TimestampField, StringField, BooleanField FROM ")
.append(TABLE_ID.getTable())
.toString();
TableId destinationTable = TableId.of(DATASET, tableName);
QueryJobConfiguration configuration = QueryJobConfiguration.newBuilder(query)
.setDefaultDataset(DatasetId.of(DATASET))
.setDestinationTable(destinationTable)
.setDryRun(true)
.build();
Job remoteJob = bigquery.create(JobInfo.of(configuration));
System.out.println("job (dryrun): " + remoteJob);
assertNull(remoteJob.getJobId().getJob());
assertEquals(DONE, remoteJob.getStatus().getState());
assertNotNull(remoteJob.getConfiguration());
}

@Test
public void testExtractJob() throws InterruptedException, TimeoutException {
String tableName = "test_export_job_table";
Expand Down