Search in sources :

Example 11 with JobConfiguration

use of com.google.api.services.bigquery.model.JobConfiguration in project beam by apache.

the class FakeJobService method startExtractJob.

@Override
public void startExtractJob(JobReference jobRef, JobConfigurationExtract extractConfig) throws InterruptedException, IOException {
    checkArgument(extractConfig.getDestinationFormat().equals("AVRO"), "Only extract to AVRO is supported");
    synchronized (allJobs) {
        ++numExtractJobCalls;
        Job job = new Job();
        job.setJobReference(jobRef);
        job.setConfiguration(new JobConfiguration().setExtract(extractConfig));
        job.setKind(" bigquery#job");
        job.setStatus(new JobStatus().setState("PENDING"));
        allJobs.put(jobRef.getProjectId(), jobRef.getJobId(), new JobInfo(job));
    }
}
Also used : JobStatus(com.google.api.services.bigquery.model.JobStatus) Job(com.google.api.services.bigquery.model.Job) JobConfiguration(com.google.api.services.bigquery.model.JobConfiguration)

Example 12 with JobConfiguration

use of com.google.api.services.bigquery.model.JobConfiguration in project beam by apache.

the class FakeJobService method startQueryJob.

@Override
public void startQueryJob(JobReference jobRef, JobConfigurationQuery query) {
    synchronized (allJobs) {
        Job job = new Job();
        job.setJobReference(jobRef);
        job.setConfiguration(new JobConfiguration().setQuery(query));
        job.setKind(" bigquery#job");
        job.setStatus(new JobStatus().setState("PENDING"));
        allJobs.put(jobRef.getProjectId(), jobRef.getJobId(), new JobInfo(job));
    }
}
Also used : JobStatus(com.google.api.services.bigquery.model.JobStatus) Job(com.google.api.services.bigquery.model.Job) JobConfiguration(com.google.api.services.bigquery.model.JobConfiguration)

Aggregations

Job (com.google.api.services.bigquery.model.Job)12 JobConfiguration (com.google.api.services.bigquery.model.JobConfiguration)12 JobStatus (com.google.api.services.bigquery.model.JobStatus)11 TableReference (com.google.api.services.bigquery.model.TableReference)4 JobConfigurationQuery (com.google.api.services.bigquery.model.JobConfigurationQuery)3 JobReference (com.google.api.services.bigquery.model.JobReference)3 JobStatistics (com.google.api.services.bigquery.model.JobStatistics)3 TableRow (com.google.api.services.bigquery.model.TableRow)3 Dataset (com.google.api.services.bigquery.model.Dataset)2 JobStatistics2 (com.google.api.services.bigquery.model.JobStatistics2)2 Table (com.google.api.services.bigquery.model.Table)2 Random (java.util.Random)2 ResourceId (org.apache.beam.sdk.io.fs.ResourceId)2 Matchers.containsString (org.hamcrest.Matchers.containsString)2 Test (org.junit.Test)2 Matchers.anyString (org.mockito.Matchers.anyString)2 ErrorProto (com.google.api.services.bigquery.model.ErrorProto)1 GetQueryResultsResponse (com.google.api.services.bigquery.model.GetQueryResultsResponse)1 TableSchema (com.google.api.services.bigquery.model.TableSchema)1 ImmutableList (com.google.common.collect.ImmutableList)1