Skip to content

Commit c26a9e8

Browse files
committed
---
yaml --- r: 2103 b: refs/heads/pubsub-alpha c: 329bd70 h: refs/heads/master i: 2101: bcee5b5 2099: 1f0fb33 2095: 773b9fe
1 parent 4654f33 commit c26a9e8

13 files changed

Lines changed: 121 additions & 234 deletions

File tree

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ refs/heads/master: 689bbb466df4b2d5d2483d6edb8ac5c7c7f7c6fa
33
refs/heads/travis: e21ee7b88a5edc3f3d8c71f90c3fc32abf7e8dd6
44
refs/heads/gh-pages: 4e0561bb4504bf647db669a14417b2b2c87ba45d
55
refs/heads/bigquery: 762fa5830e6c398c0396177e3e7fd243bd62cfc3
6-
refs/heads/pubsub-alpha: 45f5661ce58f27d6489aed2919c2a6ce13e480ff
6+
refs/heads/pubsub-alpha: 329bd70010b0bf49a2a096e1b35524102f364ff0
77
refs/heads/resource-manager: ebf4adc5ee835cd2086c4ac5b4e78d01a5a005a7
88
refs/heads/update-datastore: 482954f2c5055231e5b3122ea91d2ba00ce8187c
99
refs/tags/0.0.9: 22f1839238f66c39e67ed4dfdcd273b1ae2e8444

branches/pubsub-alpha/README.md

Lines changed: 78 additions & 78 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,10 @@ Java idiomatic client for [Google Cloud Platform][cloud-platform] services.
1212

1313
This client supports the following Google Cloud Platform services:
1414

15+
- [Google Cloud BigQuery] (#google-cloud-bigquery)
1516
- [Google Cloud Datastore] (#google-cloud-datastore)
16-
- [Google Cloud Storage] (#google-cloud-storage)
1717
- [Google Cloud Resource Manager] (#google-cloud-resource-manager)
18-
- [Google Cloud BigQuery] (#google-cloud-bigquery)
18+
- [Google Cloud Storage] (#google-cloud-storage)
1919

2020
> Note: This client is a work-in-progress, and may occasionally
2121
> make backwards-incompatible changes.
@@ -42,14 +42,14 @@ libraryDependencies += "com.google.gcloud" % "gcloud-java" % "0.1.1"
4242
Example Applications
4343
--------------------
4444

45+
- [`BigQueryExample`](https://github.com/GoogleCloudPlatform/gcloud-java/blob/master/gcloud-java-examples/src/main/java/com/google/gcloud/examples/BigQueryExample.java) - A simple command line interface providing some of Cloud BigQuery's functionality
46+
- Read more about using this application on the [`gcloud-java-examples` docs page](http://googlecloudplatform.github.io/gcloud-java/apidocs/?com/google/gcloud/examples/BigQueryExample.html).
4547
- [`DatastoreExample`](https://github.com/GoogleCloudPlatform/gcloud-java/blob/master/gcloud-java-examples/src/main/java/com/google/gcloud/examples/DatastoreExample.java) - A simple command line interface for the Cloud Datastore
4648
- Read more about using this application on the [`gcloud-java-examples` docs page](http://googlecloudplatform.github.io/gcloud-java/apidocs/?com/google/gcloud/examples/DatastoreExample.html).
47-
- [`StorageExample`](https://github.com/GoogleCloudPlatform/gcloud-java/blob/master/gcloud-java-examples/src/main/java/com/google/gcloud/examples/StorageExample.java) - A simple command line interface providing some of Cloud Storage's functionality
48-
- Read more about using this application on the [`gcloud-java-examples` docs page](http://googlecloudplatform.github.io/gcloud-java/apidocs/?com/google/gcloud/examples/StorageExample.html).
4949
- [`ResourceManagerExample`](https://github.com/GoogleCloudPlatform/gcloud-java/blob/master/gcloud-java-examples/src/main/java/com/google/gcloud/examples/ResourceManagerExample.java) - A simple command line interface providing some of Cloud Resource Manager's functionality
5050
- Read more about using this application on the [`gcloud-java-examples` docs page](http://googlecloudplatform.github.io/gcloud-java/apidocs/?com/google/gcloud/examples/ResourceManagerExample.html).
51-
- [`BigQueryExample`](https://github.com/GoogleCloudPlatform/gcloud-java/blob/master/gcloud-java-examples/src/main/java/com/google/gcloud/examples/BigQueryExample.java) - A simple command line interface providing some of Cloud BigQuery's functionality
52-
- Read more about using this application on the [`gcloud-java-examples` docs page](http://googlecloudplatform.github.io/gcloud-java/apidocs/?com/google/gcloud/examples/BigQueryExample.html).
51+
- [`StorageExample`](https://github.com/GoogleCloudPlatform/gcloud-java/blob/master/gcloud-java-examples/src/main/java/com/google/gcloud/examples/StorageExample.java) - A simple command line interface providing some of Cloud Storage's functionality
52+
- Read more about using this application on the [`gcloud-java-examples` docs page](http://googlecloudplatform.github.io/gcloud-java/apidocs/?com/google/gcloud/examples/StorageExample.html).
5353

5454
Specifying a Project ID
5555
-----------------------
@@ -109,6 +109,51 @@ Next, choose a method for authenticating API requests from within your project:
109109
4. Google Cloud SDK credentials
110110
5. Compute Engine credentials
111111
112+
Google Cloud BigQuery
113+
----------------------
114+
115+
- [API Documentation][bigquery-api]
116+
- [Official Documentation][cloud-bigquery-docs]
117+
118+
#### Preview
119+
120+
Here is a code snippet showing a simple usage example from within Compute/App Engine. Note that you
121+
must [supply credentials](#authentication) and a project ID if running this snippet elsewhere.
122+
123+
```java
124+
import com.google.gcloud.bigquery.BaseTableInfo;
125+
import com.google.gcloud.bigquery.BigQuery;
126+
import com.google.gcloud.bigquery.BigQueryOptions;
127+
import com.google.gcloud.bigquery.Field;
128+
import com.google.gcloud.bigquery.JobStatus;
129+
import com.google.gcloud.bigquery.LoadJobInfo;
130+
import com.google.gcloud.bigquery.Schema;
131+
import com.google.gcloud.bigquery.TableId;
132+
import com.google.gcloud.bigquery.TableInfo;
133+
134+
BigQuery bigquery = BigQueryOptions.defaultInstance().service();
135+
TableId tableId = TableId.of("dataset", "table");
136+
BaseTableInfo info = bigquery.getTable(tableId);
137+
if (info == null) {
138+
System.out.println("Creating table " + tableId);
139+
Field integerField = Field.of("fieldName", Field.Type.integer());
140+
bigquery.create(TableInfo.of(tableId, Schema.of(integerField)));
141+
} else {
142+
System.out.println("Loading data into table " + tableId);
143+
LoadJobInfo loadJob = LoadJobInfo.of(tableId, "gs://bucket/path");
144+
loadJob = bigquery.create(loadJob);
145+
while (loadJob.status().state() != JobStatus.State.DONE) {
146+
Thread.sleep(1000L);
147+
loadJob = bigquery.getJob(loadJob.jobId());
148+
}
149+
if (loadJob.status().error() != null) {
150+
System.out.println("Job completed with errors");
151+
} else {
152+
System.out.println("Job succeeded");
153+
}
154+
}
155+
```
156+
112157
Google Cloud Datastore
113158
----------------------
114159
@@ -149,45 +194,6 @@ if (entity == null) {
149194
}
150195
```
151196
152-
Google Cloud Storage
153-
----------------------
154-
155-
- [API Documentation][storage-api]
156-
- [Official Documentation][cloud-storage-docs]
157-
158-
*Follow the [activation instructions][cloud-storage-activation] to use the Google Cloud Storage API with your project.*
159-
160-
#### Preview
161-
162-
Here is a code snippet showing a simple usage example from within Compute/App Engine. Note that you must [supply credentials](#authentication) and a project ID if running this snippet elsewhere.
163-
164-
```java
165-
import static java.nio.charset.StandardCharsets.UTF_8;
166-
167-
import com.google.gcloud.storage.Blob;
168-
import com.google.gcloud.storage.BlobId;
169-
import com.google.gcloud.storage.Storage;
170-
import com.google.gcloud.storage.StorageOptions;
171-
172-
import java.nio.ByteBuffer;
173-
import java.nio.channels.WritableByteChannel;
174-
175-
Storage storage = StorageOptions.defaultInstance().service();
176-
BlobId blobId = BlobId.of("bucket", "blob_name");
177-
Blob blob = Blob.load(storage, blobId);
178-
if (blob == null) {
179-
BlobInfo blobInfo = BlobInfo.builder(blobId).contentType("text/plain").build();
180-
storage.create(blobInfo, "Hello, Cloud Storage!".getBytes(UTF_8));
181-
} else {
182-
System.out.println("Updating content for " + blobId.name());
183-
byte[] prevContent = blob.content();
184-
System.out.println(new String(prevContent, UTF_8));
185-
WritableByteChannel channel = blob.writer();
186-
channel.write(ByteBuffer.wrap("Updated content".getBytes(UTF_8)));
187-
channel.close();
188-
}
189-
```
190-
191197
Google Cloud Resource Manager
192198
----------------------
193199
@@ -219,48 +225,42 @@ while (projectIterator.hasNext()) {
219225
}
220226
```
221227
222-
Google Cloud BigQuery
228+
Google Cloud Storage
223229
----------------------
224230
225-
- [API Documentation][bigquery-api]
226-
- [Official Documentation][cloud-bigquery-docs]
231+
- [API Documentation][storage-api]
232+
- [Official Documentation][cloud-storage-docs]
233+
234+
*Follow the [activation instructions][cloud-storage-activation] to use the Google Cloud Storage API with your project.*
227235
228236
#### Preview
229237
230-
Here is a code snippet showing a simple usage example from within Compute/App Engine. Note that you
231-
must [supply credentials](#authentication) and a project ID if running this snippet elsewhere.
238+
Here is a code snippet showing a simple usage example from within Compute/App Engine. Note that you must [supply credentials](#authentication) and a project ID if running this snippet elsewhere.
232239
233240
```java
234-
import com.google.gcloud.bigquery.BaseTableInfo;
235-
import com.google.gcloud.bigquery.BigQuery;
236-
import com.google.gcloud.bigquery.BigQueryOptions;
237-
import com.google.gcloud.bigquery.Field;
238-
import com.google.gcloud.bigquery.JobStatus;
239-
import com.google.gcloud.bigquery.LoadJobInfo;
240-
import com.google.gcloud.bigquery.Schema;
241-
import com.google.gcloud.bigquery.TableId;
242-
import com.google.gcloud.bigquery.TableInfo;
241+
import static java.nio.charset.StandardCharsets.UTF_8;
243242
244-
BigQuery bigquery = BigQueryOptions.defaultInstance().service();
245-
TableId tableId = TableId.of("dataset", "table");
246-
BaseTableInfo info = bigquery.getTable(tableId);
247-
if (info == null) {
248-
System.out.println("Creating table " + tableId);
249-
Field integerField = Field.of("fieldName", Field.Type.integer());
250-
bigquery.create(TableInfo.of(tableId, Schema.of(integerField)));
243+
import com.google.gcloud.storage.Blob;
244+
import com.google.gcloud.storage.BlobId;
245+
import com.google.gcloud.storage.Storage;
246+
import com.google.gcloud.storage.StorageOptions;
247+
248+
import java.nio.ByteBuffer;
249+
import java.nio.channels.WritableByteChannel;
250+
251+
Storage storage = StorageOptions.defaultInstance().service();
252+
BlobId blobId = BlobId.of("bucket", "blob_name");
253+
Blob blob = Blob.load(storage, blobId);
254+
if (blob == null) {
255+
BlobInfo blobInfo = BlobInfo.builder(blobId).contentType("text/plain").build();
256+
storage.create(blobInfo, "Hello, Cloud Storage!".getBytes(UTF_8));
251257
} else {
252-
System.out.println("Loading data into table " + tableId);
253-
LoadJobInfo loadJob = LoadJobInfo.of(tableId, "gs://bucket/path");
254-
loadJob = bigquery.create(loadJob);
255-
while (loadJob.status().state() != JobStatus.State.DONE) {
256-
Thread.sleep(1000L);
257-
loadJob = bigquery.getJob(loadJob.jobId());
258-
}
259-
if (loadJob.status().error() != null) {
260-
System.out.println("Job completed with errors");
261-
} else {
262-
System.out.println("Job succeeded");
263-
}
258+
System.out.println("Updating content for " + blobId.name());
259+
byte[] prevContent = blob.content();
260+
System.out.println(new String(prevContent, UTF_8));
261+
WritableByteChannel channel = blob.writer();
262+
channel.write(ByteBuffer.wrap("Updated content".getBytes(UTF_8)));
263+
channel.close();
264264
}
265265
```
266266

branches/pubsub-alpha/gcloud-java-bigquery/src/main/java/com/google/gcloud/bigquery/BigQueryImpl.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -412,7 +412,6 @@ public InsertAllResponse insertAll(InsertAllRequest request) throws BigQueryExce
412412
final TableDataInsertAllRequest requestPb = new TableDataInsertAllRequest();
413413
requestPb.setIgnoreUnknownValues(request.ignoreUnknownValues());
414414
requestPb.setSkipInvalidRows(request.skipInvalidRows());
415-
requestPb.setTemplateSuffix(request.templateSuffix());
416415
List<Rows> rowsPb = Lists.transform(request.rows(), new Function<RowToInsert, Rows>() {
417416
@Override
418417
public Rows apply(RowToInsert rowToInsert) {

branches/pubsub-alpha/gcloud-java-bigquery/src/main/java/com/google/gcloud/bigquery/InsertAllRequest.java

Lines changed: 2 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,6 @@ public class InsertAllRequest implements Serializable {
4545
private final List<RowToInsert> rows;
4646
private final Boolean skipInvalidRows;
4747
private final Boolean ignoreUnknownValues;
48-
private final String templateSuffix;
4948

5049
/**
5150
* A Google Big Query row to be inserted into a table. Each {@code RowToInsert} has an associated
@@ -141,7 +140,6 @@ public static final class Builder {
141140
private List<RowToInsert> rows;
142141
private Boolean skipInvalidRows;
143142
private Boolean ignoreUnknownValues;
144-
private String templateSuffix;
145143

146144
private Builder() {}
147145

@@ -233,20 +231,6 @@ public Builder ignoreUnknownValues(boolean ignoreUnknownValues) {
233231
return this;
234232
}
235233

236-
/**
237-
* If specified, the destination table is treated as a base template. Rows are inserted into an
238-
* instance table named "{destination}{templateSuffix}". BigQuery will manage the creation of
239-
* the instance table, using the schema of the base template table.
240-
*
241-
* @see <a
242-
* href="https://cloud.google.com/bigquery/streaming-data-into-bigquery#template-tables">
243-
* Template Tables</a>
244-
*/
245-
public Builder templateSuffix(String templateSuffix) {
246-
this.templateSuffix = templateSuffix;
247-
return this;
248-
}
249-
250234
public InsertAllRequest build() {
251235
return new InsertAllRequest(this);
252236
}
@@ -257,7 +241,6 @@ private InsertAllRequest(Builder builder) {
257241
this.rows = ImmutableList.copyOf(checkNotNull(builder.rows));
258242
this.ignoreUnknownValues = builder.ignoreUnknownValues;
259243
this.skipInvalidRows = builder.skipInvalidRows;
260-
this.templateSuffix = builder.templateSuffix;
261244
}
262245

263246
/**
@@ -290,19 +273,6 @@ public Boolean skipInvalidRows() {
290273
return skipInvalidRows;
291274
}
292275

293-
/**
294-
* If specified, the destination table is treated as a base template. Rows are inserted into an
295-
* instance table named "{destination}{templateSuffix}". BigQuery will manage the creation of the
296-
* instance table, using the schema of the base template table.
297-
*
298-
* @see <a
299-
* href="https://cloud.google.com/bigquery/streaming-data-into-bigquery#template-tables">
300-
* Template Tables</a>
301-
*/
302-
public String templateSuffix() {
303-
return templateSuffix;
304-
}
305-
306276
/**
307277
* Returns a builder for an {@code InsertAllRequest} object given the destination table.
308278
*/
@@ -414,13 +384,12 @@ public String toString() {
414384
.add("rows", rows)
415385
.add("ignoreUnknownValues", ignoreUnknownValues)
416386
.add("skipInvalidRows", skipInvalidRows)
417-
.add("templateSuffix", templateSuffix)
418387
.toString();
419388
}
420389

421390
@Override
422391
public int hashCode() {
423-
return Objects.hash(table, rows, ignoreUnknownValues, skipInvalidRows, templateSuffix);
392+
return Objects.hash(table, rows, ignoreUnknownValues, skipInvalidRows);
424393
}
425394

426395
@Override
@@ -432,7 +401,6 @@ public boolean equals(Object obj) {
432401
return Objects.equals(table, other.table)
433402
&& Objects.equals(rows, other.rows)
434403
&& Objects.equals(ignoreUnknownValues, other.ignoreUnknownValues)
435-
&& Objects.equals(skipInvalidRows, other.skipInvalidRows)
436-
&& Objects.equals(templateSuffix, other.templateSuffix);
404+
&& Objects.equals(skipInvalidRows, other.skipInvalidRows);
437405
}
438406
}

branches/pubsub-alpha/gcloud-java-bigquery/src/main/java/com/google/gcloud/bigquery/package-info.java

Lines changed: 3 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -18,28 +18,9 @@
1818
* A client to Google Cloud BigQuery.
1919
*
2020
* <p>A simple usage example:
21-
* <pre> {@code
22-
* BigQuery bigquery = BigQueryOptions.defaultInstance().service();
23-
* TableId tableId = TableId.of("dataset", "table");
24-
* BaseTableInfo info = bigquery.getTable(tableId);
25-
* if (info == null) {
26-
* System.out.println("Creating table " + tableId);
27-
* Field integerField = Field.of("fieldName", Field.Type.integer());
28-
* bigquery.create(TableInfo.of(tableId, Schema.of(integerField)));
29-
* } else {
30-
* System.out.println("Loading data into table " + tableId);
31-
* LoadJobInfo loadJob = LoadJobInfo.of(tableId, "gs://bucket/path");
32-
* loadJob = bigquery.create(loadJob);
33-
* while (loadJob.status().state() != JobStatus.State.DONE) {
34-
* Thread.sleep(1000L);
35-
* loadJob = bigquery.getJob(loadJob.jobId());
36-
* }
37-
* if (loadJob.status().error() != null) {
38-
* System.out.println("Job completed with errors");
39-
* } else {
40-
* System.out.println("Job succeeded");
41-
* }
42-
* }}</pre>
21+
* <pre>{@code
22+
* //TODO(mziccard): add code example
23+
* }</pre>
4324
*
4425
* @see <a href="https://cloud.google.com/bigquery/">Google Cloud BigQuery</a>
4526
*/

branches/pubsub-alpha/gcloud-java-bigquery/src/test/java/com/google/gcloud/bigquery/BigQueryImplTest.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -614,7 +614,6 @@ public void testInsertAll() {
614614
.rows(rows)
615615
.skipInvalidRows(false)
616616
.ignoreUnknownValues(true)
617-
.templateSuffix("suffix")
618617
.build();
619618
TableDataInsertAllRequest requestPb = new TableDataInsertAllRequest().setRows(
620619
Lists.transform(rows, new Function<RowToInsert, TableDataInsertAllRequest.Rows>() {
@@ -624,7 +623,7 @@ public TableDataInsertAllRequest.Rows apply(RowToInsert rowToInsert) {
624623
.setJson(rowToInsert.content());
625624
}
626625
})
627-
).setSkipInvalidRows(false).setIgnoreUnknownValues(true).setTemplateSuffix("suffix");
626+
).setSkipInvalidRows(false).setIgnoreUnknownValues(true);
628627
TableDataInsertAllResponse responsePb = new TableDataInsertAllResponse().setInsertErrors(
629628
ImmutableList.of(new TableDataInsertAllResponse.InsertErrors().setIndex(0L).setErrors(
630629
ImmutableList.of(new ErrorProto().setMessage("ErrorMessage")))));

0 commit comments

Comments
 (0)