Skip to content

Commit 0136802

Browse files
authored
---
yaml --- r: 8925 b: refs/heads/lesv-patch-1 c: 7d144e2 h: refs/heads/master i: 8923: ad1e255
1 parent 5aaea84 commit 0136802

153 files changed

Lines changed: 16519 additions & 2566 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ refs/tags/v0.22.0: 18b298fe4bfe8ec2f20b0e0bf7ffdcce5cc3c5fe
6666
refs/heads/vam-google-patch-1: d0c8fee3a4074d0bf7360ce8c4f7f7223d0ee7b9
6767
refs/heads/vam-google-patch-CODEOWNERS: 2ac1616e25229e51d08a984708ef1918f91a35ee
6868
refs/heads/danoscarmike-patch-1: 7342a9916bce4ed00002c7202e2a16c5d46afaea
69-
refs/heads/lesv-patch-1: 47a55dcb94b8a33fb9e752d595430ab451d878f4
69+
refs/heads/lesv-patch-1: 7d144e26530d094d90f3eefe775deedb092c50ea
7070
refs/heads/ml-update-branch: 079dd6610017f5c51b9d1938c12d6d55b61513cf
7171
refs/heads/vkedia-patch-2: 7d8241388a9769a5c069334761b06c7012c878e7
7272
refs/heads/vkedia-patch-3: 4d128043acaa7db9160faf439d2ca6104e8a88cb

branches/lesv-patch-1/README.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,15 @@ Java idiomatic client for [Google Cloud Platform][cloud-platform] services.
1212
- [Homepage](https://googlecloudplatform.github.io/google-cloud-java/)
1313
- [API Documentation](https://googlecloudplatform.github.io/google-cloud-java/apidocs)
1414

15-
This client supports the following Google Cloud Platform services at a [GA](#versioning) quality level:
15+
This library supports the following Google Cloud Platform services with clients at a [GA](#versioning) quality level:
1616
- [Stackdriver Logging](google-cloud-logging) (GA)
1717
- [Cloud Datastore](google-cloud-datastore) (GA)
1818
- [Cloud Natural Language](google-cloud-language) (GA)
1919
- [Cloud Storage](google-cloud-storage) (GA)
2020
- [Cloud Translation](google-cloud-translate) (GA)
2121
- [Cloud Vision](google-cloud-vision) (GA)
2222

23-
This client supports the following Google Cloud Platform services at a [Beta](#versioning) quality level:
23+
This library supports the following Google Cloud Platform services with clients at a [Beta](#versioning) quality level:
2424

2525
- [BigQuery](google-cloud-bigquery) (Beta)
2626
- [Cloud Data Loss Prevention](google-cloud-dlp) (Beta)
@@ -32,12 +32,13 @@ This client supports the following Google Cloud Platform services at a [Beta](#v
3232
- [Cloud Video Intelligence](google-cloud-video-intelligence) (Beta)
3333
- [Stackdriver Trace](google-cloud-trace) (Beta)
3434

35-
This client supports the following Google Cloud Platform services at an [Alpha](#versioning) quality level:
35+
This library supports the following Google Cloud Platform services with clients at an [Alpha](#versioning) quality level:
3636

3737
- [Cloud Compute](google-cloud-compute) (Alpha)
3838
- [Cloud DNS](google-cloud-dns) (Alpha)
3939
- [Cloud Resource Manager](google-cloud-resourcemanager) (Alpha)
4040
- [Cloud Speech](google-cloud-speech) (Alpha)
41+
- [Dialogflow](google-cloud-dialogflow) (Alpha)
4142

4243
> Note: google-cloud-java is a work-in-progress, and may occasionally
4344
> make backwards-incompatible changes.

branches/lesv-patch-1/google-cloud-bigquery/pom.xml

Lines changed: 0 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
</parent>
1717
<properties>
1818
<site.installationModule>google-cloud-bigquery</site.installationModule>
19-
<artifact.version>${project.version}</artifact.version>
2019
</properties>
2120
<dependencies>
2221
<dependency>
@@ -76,15 +75,6 @@
7675
</dependency>
7776
</dependencies>
7877
<build>
79-
<resources>
80-
<resource>
81-
<directory>./..</directory>
82-
<filtering>true</filtering>
83-
<includes>
84-
<include>project.properties</include>
85-
</includes>
86-
</resource>
87-
</resources>
8878
<plugins>
8979
<plugin>
9080
<!-- Allow script to run, so we can run benchmarks. -->
@@ -94,25 +84,6 @@
9484
<cleanupDaemonThreads>false</cleanupDaemonThreads>
9585
<skip>false</skip>
9686
</configuration>
97-
</plugin>
98-
<plugin>
99-
<artifactId>maven-antrun-plugin</artifactId>
100-
<version>1.4</version>
101-
<executions>
102-
<execution>
103-
<phase>process-resources</phase>
104-
<configuration>
105-
<tasks>
106-
<copy file="${project.build.outputDirectory}/project.properties"
107-
toFile="${project.build.outputDirectory}/com/google/cloud/bigquery/project.properties"
108-
overwrite="true" />
109-
</tasks>
110-
</configuration>
111-
<goals>
112-
<goal>run</goal>
113-
</goals>
114-
</execution>
115-
</executions>
11687
</plugin>
11788
<plugin>
11889
<groupId>org.codehaus.mojo</groupId>

branches/lesv-patch-1/google-cloud-bigquery/src/main/java/com/google/cloud/bigquery/JobInfo.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919
import com.google.api.services.bigquery.model.Job;
2020
import com.google.common.base.Function;
2121
import com.google.common.base.MoreObjects;
22-
2322
import java.io.Serializable;
2423
import java.util.Objects;
2524

@@ -178,7 +177,7 @@ static final class BuilderImpl extends Builder {
178177
this.status = JobStatus.fromPb(jobPb.getStatus());
179178
}
180179
if (jobPb.getStatistics() != null) {
181-
this.statistics = JobStatistics.fromPb(jobPb.getStatistics());
180+
this.statistics = JobStatistics.fromPb(jobPb);
182181
}
183182
this.userEmail = jobPb.getUserEmail();
184183
this.configuration = JobConfiguration.fromPb(jobPb.getConfiguration());

branches/lesv-patch-1/google-cloud-bigquery/src/main/java/com/google/cloud/bigquery/JobStatistics.java

Lines changed: 29 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,13 @@
1616

1717
package com.google.cloud.bigquery;
1818

19+
import com.google.api.services.bigquery.model.JobConfiguration;
1920
import com.google.api.services.bigquery.model.JobStatistics2;
2021
import com.google.api.services.bigquery.model.JobStatistics3;
2122
import com.google.api.services.bigquery.model.JobStatistics4;
2223
import com.google.common.base.MoreObjects;
2324
import com.google.common.base.MoreObjects.ToStringHelper;
2425
import com.google.common.collect.Lists;
25-
2626
import java.io.Serializable;
2727
import java.util.List;
2828
import java.util.Objects;
@@ -104,7 +104,9 @@ private Builder() {}
104104

105105
private Builder(com.google.api.services.bigquery.model.JobStatistics statisticsPb) {
106106
super(statisticsPb);
107-
this.destinationUriFileCounts = statisticsPb.getExtract().getDestinationUriFileCounts();
107+
if (statisticsPb.getExtract() != null) {
108+
this.destinationUriFileCounts = statisticsPb.getExtract().getDestinationUriFileCounts();
109+
}
108110
}
109111

110112
Builder setDestinationUriFileCounts(List<Long> destinationUriFileCounts) {
@@ -192,10 +194,12 @@ private Builder() {}
192194

193195
private Builder(com.google.api.services.bigquery.model.JobStatistics statisticsPb) {
194196
super(statisticsPb);
195-
this.inputBytes = statisticsPb.getLoad().getInputFileBytes();
196-
this.inputFiles = statisticsPb.getLoad().getInputFiles();
197-
this.outputBytes = statisticsPb.getLoad().getOutputBytes();
198-
this.outputRows = statisticsPb.getLoad().getOutputRows();
197+
if (statisticsPb.getLoad() != null) {
198+
this.inputBytes = statisticsPb.getLoad().getInputFileBytes();
199+
this.inputFiles = statisticsPb.getLoad().getInputFiles();
200+
this.outputBytes = statisticsPb.getLoad().getOutputBytes();
201+
this.outputRows = statisticsPb.getLoad().getOutputRows();
202+
}
199203
}
200204

201205
Builder setInputBytes(Long inputBytes) {
@@ -332,13 +336,16 @@ private Builder() {}
332336

333337
private Builder(com.google.api.services.bigquery.model.JobStatistics statisticsPb) {
334338
super(statisticsPb);
335-
this.billingTier = statisticsPb.getQuery().getBillingTier();
336-
this.cacheHit = statisticsPb.getQuery().getCacheHit();
337-
this.totalBytesBilled = statisticsPb.getQuery().getTotalBytesBilled();
338-
this.totalBytesProcessed = statisticsPb.getQuery().getTotalBytesProcessed();
339-
if (statisticsPb.getQuery().getQueryPlan() != null) {
340-
this.queryPlan =
341-
Lists.transform(statisticsPb.getQuery().getQueryPlan(), QueryStage.FROM_PB_FUNCTION);
339+
if (statisticsPb.getQuery() != null) {
340+
this.billingTier = statisticsPb.getQuery().getBillingTier();
341+
this.cacheHit = statisticsPb.getQuery().getCacheHit();
342+
this.totalBytesBilled = statisticsPb.getQuery().getTotalBytesBilled();
343+
this.totalBytesProcessed = statisticsPb.getQuery().getTotalBytesProcessed();
344+
if (statisticsPb.getQuery().getQueryPlan() != null) {
345+
this.queryPlan =
346+
Lists.transform(
347+
statisticsPb.getQuery().getQueryPlan(), QueryStage.FROM_PB_FUNCTION);
348+
}
342349
}
343350
}
344351

@@ -577,16 +584,19 @@ com.google.api.services.bigquery.model.JobStatistics toPb() {
577584
}
578585

579586
@SuppressWarnings("unchecked")
580-
static <T extends JobStatistics> T fromPb(
581-
com.google.api.services.bigquery.model.JobStatistics statisticPb) {
582-
if (statisticPb.getLoad() != null) {
587+
static <T extends JobStatistics> T fromPb(com.google.api.services.bigquery.model.Job jobPb) {
588+
JobConfiguration jobConfigPb = jobPb.getConfiguration();
589+
com.google.api.services.bigquery.model.JobStatistics statisticPb = jobPb.getStatistics();
590+
if (jobConfigPb.getLoad() != null) {
583591
return (T) LoadStatistics.fromPb(statisticPb);
584-
} else if (statisticPb.getExtract() != null) {
592+
} else if (jobConfigPb.getExtract() != null) {
585593
return (T) ExtractStatistics.fromPb(statisticPb);
586-
} else if (statisticPb.getQuery() != null) {
594+
} else if (jobConfigPb.getQuery() != null) {
587595
return (T) QueryStatistics.fromPb(statisticPb);
588-
} else {
596+
} else if (jobConfigPb.getCopy() != null) {
589597
return (T) CopyStatistics.fromPb(statisticPb);
598+
} else {
599+
throw new IllegalArgumentException("unknown job configuration: " + jobConfigPb);
590600
}
591601
}
592602
}

branches/lesv-patch-1/google-cloud-bigquery/src/main/java/com/google/cloud/bigquery/ViewDefinition.java

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222
import com.google.common.base.MoreObjects.ToStringHelper;
2323
import com.google.common.collect.ImmutableList;
2424
import com.google.common.collect.Lists;
25-
2625
import java.util.List;
2726
import java.util.Objects;
2827

@@ -39,11 +38,13 @@ public class ViewDefinition extends TableDefinition {
3938

4039
private final String query;
4140
private final List<UserDefinedFunction> userDefinedFunctions;
41+
private final Boolean useLegacySql;
4242

4343
public static final class Builder extends TableDefinition.Builder<ViewDefinition, Builder> {
4444

4545
private String query;
4646
private List<UserDefinedFunction> userDefinedFunctions;
47+
private Boolean useLegacySql;
4748

4849
private Builder() {
4950
super(Type.VIEW);
@@ -53,13 +54,15 @@ private Builder(ViewDefinition viewDefinition) {
5354
super(viewDefinition);
5455
this.query = viewDefinition.query;
5556
this.userDefinedFunctions = viewDefinition.userDefinedFunctions;
57+
this.useLegacySql = viewDefinition.useLegacySql;
5658
}
5759

5860
private Builder(Table tablePb) {
5961
super(tablePb);
6062
com.google.api.services.bigquery.model.ViewDefinition viewPb = tablePb.getView();
6163
if (viewPb != null) {
6264
this.query = viewPb.getQuery();
65+
this.useLegacySql = viewPb.getUseLegacySql();
6366
if (viewPb.getUserDefinedFunctionResources() != null) {
6467
this.userDefinedFunctions = Lists.transform(viewPb.getUserDefinedFunctionResources(),
6568
UserDefinedFunction.FROM_PB_FUNCTION);
@@ -100,6 +103,19 @@ public Builder setUserDefinedFunctions(UserDefinedFunction... userDefinedFunctio
100103
return self();
101104
}
102105

106+
/**
107+
* Sets whether to use BigQuery's legacy SQL dialect for this query. By default this property is
108+
* set to {@code false}. If set to {@code false}, the query will use BigQuery's <a
109+
* href="https://cloud.google.com/bigquery/sql-reference/">Standard SQL</a>.
110+
*
111+
* <p>If set to {@code null} or {@code true}, legacy SQL dialect is used. This property is
112+
* experimental and might be subject to change.
113+
*/
114+
public Builder setUseLegacySql(Boolean useLegacySql) {
115+
this.useLegacySql = useLegacySql;
116+
return this;
117+
}
118+
103119
/**
104120
* Creates a {@code ViewDefinition} object.
105121
*/
@@ -112,6 +128,7 @@ public ViewDefinition build() {
112128
private ViewDefinition(Builder builder) {
113129
super(builder);
114130
this.query = builder.query;
131+
this.useLegacySql = builder.useLegacySql;
115132
this.userDefinedFunctions = builder.userDefinedFunctions;
116133
}
117134

@@ -135,6 +152,17 @@ public List<UserDefinedFunction> getUserDefinedFunctions() {
135152
return userDefinedFunctions;
136153
}
137154

155+
/**
156+
* Returns whether to use BigQuery's legacy SQL dialect for this query. By default this property
157+
* is set to {@code false}. If set to {@code false}, the query will use BigQuery's <a
158+
* href="https://cloud.google.com/bigquery/sql-reference/">Standard SQL</a>. If set to {@code
159+
* null} or {@code true}, legacy SQL dialect is used. This property is experimental and might be
160+
* subject to change.
161+
*/
162+
public Boolean useLegacySql() {
163+
return useLegacySql;
164+
}
165+
138166
/**
139167
* Returns a builder for the {@code ViewInfo} object.
140168
*/
@@ -147,6 +175,7 @@ public Builder toBuilder() {
147175
ToStringHelper toStringHelper() {
148176
return super.toStringHelper()
149177
.add("query", query)
178+
.add("useLegacySql", useLegacySql)
150179
.add("userDefinedFunctions", userDefinedFunctions);
151180
}
152181

@@ -172,6 +201,7 @@ Table toPb() {
172201
viewDefinition.setUserDefinedFunctionResources(Lists.transform(userDefinedFunctions,
173202
UserDefinedFunction.TO_PB_FUNCTION));
174203
}
204+
viewDefinition.setUseLegacySql(useLegacySql);
175205
tablePb.setView(viewDefinition);
176206
return tablePb;
177207
}

branches/lesv-patch-1/google-cloud-bigquery/src/test/java/com/google/cloud/bigquery/JobInfoTest.java

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -22,19 +22,17 @@
2222
import static org.junit.Assert.assertTrue;
2323

2424
import com.google.cloud.bigquery.JobInfo.CreateDisposition;
25-
import com.google.cloud.bigquery.JobInfo.WriteDisposition;
2625
import com.google.cloud.bigquery.JobInfo.SchemaUpdateOption;
26+
import com.google.cloud.bigquery.JobInfo.WriteDisposition;
2727
import com.google.cloud.bigquery.JobStatistics.CopyStatistics;
2828
import com.google.cloud.bigquery.JobStatistics.ExtractStatistics;
2929
import com.google.cloud.bigquery.JobStatistics.LoadStatistics;
3030
import com.google.cloud.bigquery.JobStatistics.QueryStatistics;
3131
import com.google.common.collect.ImmutableList;
3232
import com.google.common.collect.ImmutableMap;
33-
34-
import org.junit.Test;
35-
3633
import java.util.List;
3734
import java.util.Map;
35+
import org.junit.Test;
3836

3937
public class JobInfoTest {
4038

@@ -311,14 +309,14 @@ public void testToPbAndFromPb() {
311309
assertNull(COPY_JOB.toPb().getConfiguration().getExtract());
312310
assertNull(COPY_JOB.toPb().getConfiguration().getLoad());
313311
assertNull(COPY_JOB.toPb().getConfiguration().getQuery());
314-
assertEquals(COPY_JOB_STATISTICS, JobStatistics.fromPb(COPY_JOB.getStatistics().toPb()));
312+
assertEquals(COPY_JOB_STATISTICS, JobStatistics.fromPb(COPY_JOB.toPb()));
315313
compareJobInfo(COPY_JOB, JobInfo.fromPb(COPY_JOB.toPb()));
316314
assertTrue(JobInfo.fromPb(COPY_JOB.toPb()).getConfiguration() instanceof CopyJobConfiguration);
317315
assertNull(EXTRACT_JOB.toPb().getConfiguration().getCopy());
318316
assertNotNull(EXTRACT_JOB.toPb().getConfiguration().getExtract());
319317
assertNull(EXTRACT_JOB.toPb().getConfiguration().getLoad());
320318
assertNull(EXTRACT_JOB.toPb().getConfiguration().getQuery());
321-
assertEquals(EXTRACT_JOB_STATISTICS, JobStatistics.fromPb(EXTRACT_JOB.getStatistics().toPb()));
319+
assertEquals(EXTRACT_JOB_STATISTICS, JobStatistics.fromPb(EXTRACT_JOB.toPb()));
322320
compareJobInfo(EXTRACT_JOB, JobInfo.fromPb(EXTRACT_JOB.toPb()));
323321
assertTrue(
324322
JobInfo.fromPb(EXTRACT_JOB.toPb()).getConfiguration() instanceof ExtractJobConfiguration);
@@ -327,15 +325,15 @@ public void testToPbAndFromPb() {
327325
assertNull(LOAD_JOB.toPb().getConfiguration().getExtract());
328326
assertNotNull(LOAD_JOB.toPb().getConfiguration().getLoad());
329327
assertNull(LOAD_JOB.toPb().getConfiguration().getQuery());
330-
assertEquals(LOAD_JOB_STATISTICS, JobStatistics.fromPb(LOAD_JOB.getStatistics().toPb()));
328+
assertEquals(LOAD_JOB_STATISTICS, JobStatistics.fromPb(LOAD_JOB.toPb()));
331329
compareJobInfo(LOAD_JOB, JobInfo.fromPb(LOAD_JOB.toPb()));
332330
assertTrue(JobInfo.fromPb(LOAD_JOB.toPb()).getConfiguration() instanceof LoadJobConfiguration);
333331
assertTrue(JobInfo.fromPb(LOAD_JOB.toPb()).getStatistics() instanceof LoadStatistics);
334332
assertNull(QUERY_JOB.toPb().getConfiguration().getCopy());
335333
assertNull(QUERY_JOB.toPb().getConfiguration().getExtract());
336334
assertNull(QUERY_JOB.toPb().getConfiguration().getLoad());
337335
assertNotNull(QUERY_JOB.toPb().getConfiguration().getQuery());
338-
assertEquals(QUERY_JOB_STATISTICS, JobStatistics.fromPb(QUERY_JOB.getStatistics().toPb()));
336+
assertEquals(QUERY_JOB_STATISTICS, JobStatistics.fromPb(QUERY_JOB.toPb()));
339337
compareJobInfo(QUERY_JOB, JobInfo.fromPb(QUERY_JOB.toPb()));
340338
assertTrue(
341339
JobInfo.fromPb(QUERY_JOB.toPb()).getConfiguration() instanceof QueryJobConfiguration);

0 commit comments

Comments
 (0)