From e27907524c23fb6f47b0e1a35b05cf77090276bd Mon Sep 17 00:00:00 2001 From: DPE bot Date: Mon, 22 Jan 2018 09:50:17 -0800 Subject: [PATCH 1/3] Auto-update dependencies. --- appengine-java8/analytics/pom.xml | 2 +- appengine-java8/cloudsql-postgres/pom.xml | 2 +- appengine-java8/guestbook-cloud-datastore/pom.xml | 2 +- appengine-java8/pubsub/pom.xml | 4 ++-- appengine-java8/remote-server/pom.xml | 2 +- appengine-java8/spanner/pom.xml | 2 +- appengine/analytics/pom.xml | 2 +- appengine/remote/remote-server/pom.xml | 2 +- bigquery/cloud-client/pom.xml | 2 +- bigquery/datatransfer/cloud-client/pom.xml | 2 +- cloud-tasks/pom.xml | 2 +- dataflow/spanner-io/pom.xml | 2 +- datastore/cloud-client/pom.xml | 2 +- datastore/pom.xml | 2 +- dlp/pom.xml | 2 +- errorreporting/pom.xml | 2 +- flexible/analytics/pom.xml | 2 +- flexible/cloud-tasks/pom.xml | 2 +- flexible/cloudstorage/pom.xml | 2 +- flexible/datastore/pom.xml | 2 +- flexible/errorreporting/pom.xml | 2 +- flexible/postgres/pom.xml | 2 +- flexible/pubsub/pom.xml | 4 ++-- flexible/sparkjava/pom.xml | 2 +- kms/pom.xml | 2 +- language/analysis/pom.xml | 2 +- language/cloud-client/pom.xml | 2 +- logging/cloud-client/pom.xml | 2 +- logging/jul/pom.xml | 2 +- logging/logback/pom.xml | 2 +- mlengine/online-prediction/pom.xml | 6 +++--- monitoring/cloud-client/pom.xml | 2 +- pubsub/cloud-client/pom.xml | 2 +- spanner/cloud-client/pom.xml | 2 +- speech/cloud-client/pom.xml | 2 +- storage/cloud-client/pom.xml | 2 +- storage/storage-transfer/pom.xml | 2 +- translate/cloud-client/pom.xml | 2 +- translate/pom.xml | 2 +- video/cloud-client/pom.xml | 2 +- vision/beta/cloud-client/pom.xml | 2 +- vision/cloud-client/pom.xml | 2 +- vision/face-detection/pom.xml | 2 +- vision/label/pom.xml | 2 +- vision/landmark-detection/pom.xml | 2 +- vision/text/pom.xml | 2 +- 46 files changed, 50 insertions(+), 50 deletions(-) diff --git a/appengine-java8/analytics/pom.xml b/appengine-java8/analytics/pom.xml index 653da0081b2..ab77bf64ea1 100644 --- a/appengine-java8/analytics/pom.xml +++ b/appengine-java8/analytics/pom.xml @@ -53,7 +53,7 @@ org.apache.httpcomponents httpclient - 4.5.4 + 4.5.5 diff --git a/appengine-java8/cloudsql-postgres/pom.xml b/appengine-java8/cloudsql-postgres/pom.xml index 60c30ab936c..35b29597784 100644 --- a/appengine-java8/cloudsql-postgres/pom.xml +++ b/appengine-java8/cloudsql-postgres/pom.xml @@ -72,7 +72,7 @@ org.postgresql postgresql - 42.1.4.jre7 + 42.2.0.jre7 diff --git a/appengine-java8/guestbook-cloud-datastore/pom.xml b/appengine-java8/guestbook-cloud-datastore/pom.xml index c0e1824e5c8..f93aa4670e5 100644 --- a/appengine-java8/guestbook-cloud-datastore/pom.xml +++ b/appengine-java8/guestbook-cloud-datastore/pom.xml @@ -65,7 +65,7 @@ com.google.cloud google-cloud - 0.32.0-alpha + 0.33.0-alpha diff --git a/appengine-java8/pubsub/pom.xml b/appengine-java8/pubsub/pom.xml index 126fc4f869e..703901ac7dc 100644 --- a/appengine-java8/pubsub/pom.xml +++ b/appengine-java8/pubsub/pom.xml @@ -52,12 +52,12 @@ com.google.cloud google-cloud-pubsub - 0.32.0-beta + 0.33.0-beta com.google.cloud google-cloud-datastore - 1.14.0 + 1.15.0 diff --git a/appengine-java8/remote-server/pom.xml b/appengine-java8/remote-server/pom.xml index 202aa0ee6ae..9a865fec0a1 100644 --- a/appengine-java8/remote-server/pom.xml +++ b/appengine-java8/remote-server/pom.xml @@ -44,7 +44,7 @@ org.apache.httpcomponents httpclient - 4.5.4 + 4.5.5 diff --git a/appengine-java8/spanner/pom.xml b/appengine-java8/spanner/pom.xml index 41c61c08915..a0a51354377 100644 --- a/appengine-java8/spanner/pom.xml +++ b/appengine-java8/spanner/pom.xml @@ -44,7 +44,7 @@ com.google.cloud google-cloud-spanner - 0.32.0-beta + 0.33.0-beta javax.servlet diff --git a/appengine/analytics/pom.xml b/appengine/analytics/pom.xml index e09103545f9..e3c6132e50d 100644 --- a/appengine/analytics/pom.xml +++ b/appengine/analytics/pom.xml @@ -44,7 +44,7 @@ org.apache.httpcomponents httpclient - 4.5.4 + 4.5.5 javax.servlet diff --git a/appengine/remote/remote-server/pom.xml b/appengine/remote/remote-server/pom.xml index 3666a24e23f..04be5859113 100644 --- a/appengine/remote/remote-server/pom.xml +++ b/appengine/remote/remote-server/pom.xml @@ -44,7 +44,7 @@ org.apache.httpcomponents httpclient - 4.5.4 + 4.5.5 javax.servlet diff --git a/bigquery/cloud-client/pom.xml b/bigquery/cloud-client/pom.xml index 10c976f2767..653b6aa8766 100644 --- a/bigquery/cloud-client/pom.xml +++ b/bigquery/cloud-client/pom.xml @@ -40,7 +40,7 @@ com.google.cloud google-cloud-bigquery - 0.32.0-beta + 0.33.0-beta diff --git a/bigquery/datatransfer/cloud-client/pom.xml b/bigquery/datatransfer/cloud-client/pom.xml index 1ea753ed6f3..b9c8a77a0bb 100644 --- a/bigquery/datatransfer/cloud-client/pom.xml +++ b/bigquery/datatransfer/cloud-client/pom.xml @@ -40,7 +40,7 @@ com.google.cloud google-cloud-bigquerydatatransfer - 0.32.0-beta + 0.33.0-beta diff --git a/cloud-tasks/pom.xml b/cloud-tasks/pom.xml index 518d7a99f86..b5b66f70053 100644 --- a/cloud-tasks/pom.xml +++ b/cloud-tasks/pom.xml @@ -39,7 +39,7 @@ com.google.apis google-api-services-cloudtasks - v2beta2-rev32-1.23.0 + v2beta2-rev35-1.23.0 com.google.api-client diff --git a/dataflow/spanner-io/pom.xml b/dataflow/spanner-io/pom.xml index e2791427d29..c621c571921 100644 --- a/dataflow/spanner-io/pom.xml +++ b/dataflow/spanner-io/pom.xml @@ -88,7 +88,7 @@ com.google.cloud google-cloud-spanner - 0.32.0-beta + 0.33.0-beta diff --git a/datastore/cloud-client/pom.xml b/datastore/cloud-client/pom.xml index ca138681338..6aa92b08c4d 100644 --- a/datastore/cloud-client/pom.xml +++ b/datastore/cloud-client/pom.xml @@ -39,7 +39,7 @@ com.google.cloud google-cloud-datastore - 1.14.0 + 1.15.0 diff --git a/datastore/pom.xml b/datastore/pom.xml index 26699b43fbc..f43742e77c9 100644 --- a/datastore/pom.xml +++ b/datastore/pom.xml @@ -44,7 +44,7 @@ com.google.cloud google-cloud-datastore - 1.14.0 + 1.15.0 diff --git a/dlp/pom.xml b/dlp/pom.xml index b3887fdf562..be419cc1456 100644 --- a/dlp/pom.xml +++ b/dlp/pom.xml @@ -44,7 +44,7 @@ com.google.cloud google-cloud-dlp - 0.32.0-beta + 0.33.0-beta diff --git a/errorreporting/pom.xml b/errorreporting/pom.xml index 80562bb52f9..0903451c916 100644 --- a/errorreporting/pom.xml +++ b/errorreporting/pom.xml @@ -38,7 +38,7 @@ limitations under the License. com.google.cloud google-cloud-errorreporting - 0.32.0-beta + 0.33.0-beta diff --git a/flexible/analytics/pom.xml b/flexible/analytics/pom.xml index af75e3227e8..1d45004c50e 100644 --- a/flexible/analytics/pom.xml +++ b/flexible/analytics/pom.xml @@ -38,7 +38,7 @@ org.apache.httpcomponents httpclient - 4.5.4 + 4.5.5 javax.servlet diff --git a/flexible/cloud-tasks/pom.xml b/flexible/cloud-tasks/pom.xml index df726d8c925..196f6f8681c 100644 --- a/flexible/cloud-tasks/pom.xml +++ b/flexible/cloud-tasks/pom.xml @@ -43,7 +43,7 @@ com.google.apis google-api-services-cloudtasks - v2beta2-rev32-1.23.0 + v2beta2-rev35-1.23.0 com.google.appengine diff --git a/flexible/cloudstorage/pom.xml b/flexible/cloudstorage/pom.xml index 26807c4da7a..512392b9918 100644 --- a/flexible/cloudstorage/pom.xml +++ b/flexible/cloudstorage/pom.xml @@ -49,7 +49,7 @@ com.google.cloud google-cloud-storage - 1.14.0 + 1.15.0 diff --git a/flexible/datastore/pom.xml b/flexible/datastore/pom.xml index 7881d9a3935..febb709519b 100644 --- a/flexible/datastore/pom.xml +++ b/flexible/datastore/pom.xml @@ -49,7 +49,7 @@ com.google.cloud google-cloud-datastore - 1.14.0 + 1.15.0 diff --git a/flexible/errorreporting/pom.xml b/flexible/errorreporting/pom.xml index 7ccffd89c45..6442e7d89c1 100644 --- a/flexible/errorreporting/pom.xml +++ b/flexible/errorreporting/pom.xml @@ -47,7 +47,7 @@ com.google.cloud google-cloud-errorreporting - 0.32.0-beta + 0.33.0-beta diff --git a/flexible/postgres/pom.xml b/flexible/postgres/pom.xml index ad655f1d2c5..81b4a30383d 100644 --- a/flexible/postgres/pom.xml +++ b/flexible/postgres/pom.xml @@ -76,7 +76,7 @@ org.postgresql postgresql - 42.1.4.jre7 + 42.2.0.jre7 diff --git a/flexible/pubsub/pom.xml b/flexible/pubsub/pom.xml index c2eec673781..e2345ab94fb 100644 --- a/flexible/pubsub/pom.xml +++ b/flexible/pubsub/pom.xml @@ -63,12 +63,12 @@ com.google.cloud google-cloud-pubsub - 0.32.0-beta + 0.33.0-beta com.google.cloud google-cloud-datastore - 1.14.0 + 1.15.0 diff --git a/flexible/sparkjava/pom.xml b/flexible/sparkjava/pom.xml index 36efcf90c11..5b5f6125feb 100644 --- a/flexible/sparkjava/pom.xml +++ b/flexible/sparkjava/pom.xml @@ -61,7 +61,7 @@ limitations under the License. com.google.cloud google-cloud-datastore - 1.14.0 + 1.15.0 diff --git a/kms/pom.xml b/kms/pom.xml index 16a02d0e480..664ee70d59a 100644 --- a/kms/pom.xml +++ b/kms/pom.xml @@ -25,7 +25,7 @@ com.google.apis google-api-services-cloudkms - v1-rev32-1.23.0 + v1-rev33-1.23.0 com.google.guava diff --git a/language/analysis/pom.xml b/language/analysis/pom.xml index cd45abb6044..f5bd8aba0a1 100644 --- a/language/analysis/pom.xml +++ b/language/analysis/pom.xml @@ -39,7 +39,7 @@ limitations under the License. com.google.cloud google-cloud-language - 1.14.0 + 1.15.0 com.google.guava diff --git a/language/cloud-client/pom.xml b/language/cloud-client/pom.xml index d950efe57d3..7878f718858 100644 --- a/language/cloud-client/pom.xml +++ b/language/cloud-client/pom.xml @@ -39,7 +39,7 @@ com.google.cloud google-cloud-language - 1.14.0 + 1.15.0 com.google.guava diff --git a/logging/cloud-client/pom.xml b/logging/cloud-client/pom.xml index 792b8fe4338..5da8cea9ae3 100644 --- a/logging/cloud-client/pom.xml +++ b/logging/cloud-client/pom.xml @@ -39,7 +39,7 @@ com.google.cloud google-cloud-logging - 1.14.0 + 1.15.0 diff --git a/logging/jul/pom.xml b/logging/jul/pom.xml index d51a986d539..64a40f3e273 100644 --- a/logging/jul/pom.xml +++ b/logging/jul/pom.xml @@ -39,7 +39,7 @@ com.google.cloud google-cloud-logging - 1.14.0 + 1.15.0 diff --git a/logging/logback/pom.xml b/logging/logback/pom.xml index 5fa9428f52e..1282151c1b0 100644 --- a/logging/logback/pom.xml +++ b/logging/logback/pom.xml @@ -39,7 +39,7 @@ com.google.cloud google-cloud-logging-logback - 0.32.0-alpha + 0.33.0-alpha diff --git a/mlengine/online-prediction/pom.xml b/mlengine/online-prediction/pom.xml index 8ffa00b0074..eebd9c497c7 100644 --- a/mlengine/online-prediction/pom.xml +++ b/mlengine/online-prediction/pom.xml @@ -61,17 +61,17 @@ limitations under the License. joda-time joda-time - 2.2 + 2.9.9 com.google.api-client google-api-client - 1.22.0 + 1.23.0 com.google.apis google-api-services-discovery - v1-rev58-1.22.0 + v1-rev62-1.23.0 diff --git a/monitoring/cloud-client/pom.xml b/monitoring/cloud-client/pom.xml index 51a3d9d4b1a..464d2b82a06 100644 --- a/monitoring/cloud-client/pom.xml +++ b/monitoring/cloud-client/pom.xml @@ -55,7 +55,7 @@ com.google.cloud google-cloud-monitoring - 0.32.0-beta + 0.33.0-beta com.google.guava diff --git a/pubsub/cloud-client/pom.xml b/pubsub/cloud-client/pom.xml index b68bb534485..41a8e3d4e1e 100644 --- a/pubsub/cloud-client/pom.xml +++ b/pubsub/cloud-client/pom.xml @@ -39,7 +39,7 @@ com.google.cloud google-cloud-pubsub - 0.32.0-beta + 0.33.0-beta diff --git a/spanner/cloud-client/pom.xml b/spanner/cloud-client/pom.xml index 2cc052fdfd9..c4f48e70242 100644 --- a/spanner/cloud-client/pom.xml +++ b/spanner/cloud-client/pom.xml @@ -39,7 +39,7 @@ limitations under the License. com.google.cloud google-cloud-spanner - 0.32.0-beta + 0.33.0-beta com.google.guava diff --git a/speech/cloud-client/pom.xml b/speech/cloud-client/pom.xml index 12ba0cd6edb..783134b0452 100644 --- a/speech/cloud-client/pom.xml +++ b/speech/cloud-client/pom.xml @@ -40,7 +40,7 @@ com.google.cloud google-cloud-speech - 0.32.0-alpha + 0.33.0-alpha diff --git a/storage/cloud-client/pom.xml b/storage/cloud-client/pom.xml index d91d58211d8..b0879390d8f 100644 --- a/storage/cloud-client/pom.xml +++ b/storage/cloud-client/pom.xml @@ -39,7 +39,7 @@ com.google.cloud google-cloud-storage - 1.14.0 + 1.15.0 diff --git a/storage/storage-transfer/pom.xml b/storage/storage-transfer/pom.xml index 77cd7f30731..c1661fbf317 100644 --- a/storage/storage-transfer/pom.xml +++ b/storage/storage-transfer/pom.xml @@ -43,7 +43,7 @@ com.google.apis google-api-services-storagetransfer - v1-rev42-1.23.0 + v1-rev43-1.23.0 com.google.guava diff --git a/translate/cloud-client/pom.xml b/translate/cloud-client/pom.xml index 0db2156fe52..fa38e28c7f2 100644 --- a/translate/cloud-client/pom.xml +++ b/translate/cloud-client/pom.xml @@ -40,7 +40,7 @@ com.google.cloud google-cloud-translate - 1.14.0 + 1.15.0 diff --git a/translate/pom.xml b/translate/pom.xml index cf160a7eb84..d6ba995d53a 100644 --- a/translate/pom.xml +++ b/translate/pom.xml @@ -41,7 +41,7 @@ limitations under the License. com.google.cloud google-cloud-translate - 1.14.0 + 1.15.0 junit diff --git a/video/cloud-client/pom.xml b/video/cloud-client/pom.xml index 4bac1cfcd40..9c7bbdbf69c 100644 --- a/video/cloud-client/pom.xml +++ b/video/cloud-client/pom.xml @@ -45,7 +45,7 @@ com.google.cloud google-cloud-video-intelligence - 0.32.0-beta + 0.33.0-beta diff --git a/vision/beta/cloud-client/pom.xml b/vision/beta/cloud-client/pom.xml index 6b7a56694a4..99f11c5073d 100644 --- a/vision/beta/cloud-client/pom.xml +++ b/vision/beta/cloud-client/pom.xml @@ -38,7 +38,7 @@ com.google.cloud google-cloud-vision - 1.14.0 + 1.15.0 diff --git a/vision/cloud-client/pom.xml b/vision/cloud-client/pom.xml index 93fb5219bc0..a8e70a18b29 100644 --- a/vision/cloud-client/pom.xml +++ b/vision/cloud-client/pom.xml @@ -38,7 +38,7 @@ com.google.cloud google-cloud-vision - 1.14.0 + 1.15.0 diff --git a/vision/face-detection/pom.xml b/vision/face-detection/pom.xml index f17b80fcf3c..845d2372604 100644 --- a/vision/face-detection/pom.xml +++ b/vision/face-detection/pom.xml @@ -39,7 +39,7 @@ com.google.apis google-api-services-vision - v1-rev367-1.23.0 + v1-rev368-1.23.0 com.google.api-client diff --git a/vision/label/pom.xml b/vision/label/pom.xml index 4c60aa17608..a8ebef9ef5b 100644 --- a/vision/label/pom.xml +++ b/vision/label/pom.xml @@ -38,7 +38,7 @@ com.google.apis google-api-services-vision - v1-rev367-1.23.0 + v1-rev368-1.23.0 com.google.api-client diff --git a/vision/landmark-detection/pom.xml b/vision/landmark-detection/pom.xml index eaac4268413..9d34c76582b 100644 --- a/vision/landmark-detection/pom.xml +++ b/vision/landmark-detection/pom.xml @@ -38,7 +38,7 @@ com.google.apis google-api-services-vision - v1-rev367-1.23.0 + v1-rev368-1.23.0 com.google.api-client diff --git a/vision/text/pom.xml b/vision/text/pom.xml index b753ccc9a1b..7270f0d6560 100644 --- a/vision/text/pom.xml +++ b/vision/text/pom.xml @@ -38,7 +38,7 @@ com.google.apis google-api-services-vision - v1-rev367-1.23.0 + v1-rev368-1.23.0 com.google.api-client From 819b008e57bdbaf88e438763288d620435043fe4 Mon Sep 17 00:00:00 2001 From: Kurtis Van Gent <31518063+kurtisvg@users.noreply.github.com> Date: Mon, 22 Jan 2018 09:19:27 -0800 Subject: [PATCH 2/3] Remove jre7. --- appengine-java8/cloudsql-postgres/pom.xml | 2 +- flexible/postgres/pom.xml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/appengine-java8/cloudsql-postgres/pom.xml b/appengine-java8/cloudsql-postgres/pom.xml index 35b29597784..e6ab01ece35 100644 --- a/appengine-java8/cloudsql-postgres/pom.xml +++ b/appengine-java8/cloudsql-postgres/pom.xml @@ -72,7 +72,7 @@ org.postgresql postgresql - 42.2.0.jre7 + 42.2.0 diff --git a/flexible/postgres/pom.xml b/flexible/postgres/pom.xml index 81b4a30383d..1590c81b189 100644 --- a/flexible/postgres/pom.xml +++ b/flexible/postgres/pom.xml @@ -76,7 +76,7 @@ org.postgresql postgresql - 42.2.0.jre7 + 42.2.0 From 4455cb7288025dcbe108253a3f48a4e73abaa72e Mon Sep 17 00:00:00 2001 From: Kurtis Van Gent <31518063+kurtisvg@users.noreply.github.com> Date: Mon, 22 Jan 2018 10:06:56 -0800 Subject: [PATCH 3/3] Update BigQuery Samples. --- .../bigquery/QueryParametersSample.java | 66 ++----------------- .../com/example/bigquery/QuerySample.java | 6 +- .../java/com/example/bigquery/SimpleApp.java | 4 +- 3 files changed, 11 insertions(+), 65 deletions(-) diff --git a/bigquery/cloud-client/src/main/java/com/example/bigquery/QueryParametersSample.java b/bigquery/cloud-client/src/main/java/com/example/bigquery/QueryParametersSample.java index 771ed9c9a71..9690b51ade4 100644 --- a/bigquery/cloud-client/src/main/java/com/example/bigquery/QueryParametersSample.java +++ b/bigquery/cloud-client/src/main/java/com/example/bigquery/QueryParametersSample.java @@ -21,8 +21,7 @@ import com.google.cloud.bigquery.FieldValue; import com.google.cloud.bigquery.QueryJobConfiguration; import com.google.cloud.bigquery.QueryParameterValue; -import com.google.cloud.bigquery.QueryResponse; -import com.google.cloud.bigquery.QueryResult; +import com.google.cloud.bigquery.TableResult; import java.io.IOException; import java.util.Arrays; import java.util.List; @@ -112,8 +111,7 @@ public static void main(final String[] args) throws IOException, InterruptedExce // [START bigquery_query_params] private static void runNamed(final String corpus, final long minWordCount) throws InterruptedException { - BigQuery bigquery = - new BigQueryOptions.DefaultBigqueryFactory().create(BigQueryOptions.getDefaultInstance()); + BigQuery bigquery = BigQueryOptions.getDefaultInstance().getService(); String queryString = "SELECT word, word_count\n" @@ -131,25 +129,9 @@ private static void runNamed(final String corpus, final long minWordCount) .build(); // Execute the query. - QueryResponse response = bigquery.query(queryRequest); - - // Wait for the job to finish (if the query takes more than 10 seconds to complete). - while (!response.jobCompleted()) { - Thread.sleep(1000); - response = bigquery.getQueryResults(response.getJobId()); - } - - // Check for errors. - if (response.hasErrors()) { - String firstError = ""; - if (response.getExecutionErrors().size() != 0) { - firstError = response.getExecutionErrors().get(0).getMessage(); - } - throw new RuntimeException(firstError); - } + TableResult result = bigquery.query(queryRequest); // Print all pages of the results. - QueryResult result = response.getResult(); while (result != null) { for (List row : result.iterateAll()) { System.out.printf("%s: %d\n", row.get(0).getStringValue(), row.get(1).getLongValue()); @@ -165,8 +147,7 @@ private static void runNamed(final String corpus, final long minWordCount) */ // [START bigquery_query_params_arrays] private static void runArray(String gender, String[] states) throws InterruptedException { - BigQuery bigquery = - new BigQueryOptions.DefaultBigqueryFactory().create(BigQueryOptions.getDefaultInstance()); + BigQuery bigquery = BigQueryOptions.getDefaultInstance().getService(); String queryString = "SELECT name, sum(number) as count\n" @@ -186,25 +167,9 @@ private static void runArray(String gender, String[] states) throws InterruptedE .build(); // Execute the query. - QueryResponse response = bigquery.query(queryRequest); - - // Wait for the job to finish (if the query takes more than 10 seconds to complete). - while (!response.jobCompleted()) { - Thread.sleep(1000); - response = bigquery.getQueryResults(response.getJobId()); - } - - // Check for errors. - if (response.hasErrors()) { - String firstError = ""; - if (response.getExecutionErrors().size() != 0) { - firstError = response.getExecutionErrors().get(0).getMessage(); - } - throw new RuntimeException(firstError); - } + TableResult result = bigquery.query(queryRequest); // Print all pages of the results. - QueryResult result = response.getResult(); while (result != null) { for (List row : result.iterateAll()) { System.out.printf("%s: %d\n", row.get(0).getStringValue(), row.get(1).getLongValue()); @@ -217,8 +182,7 @@ private static void runArray(String gender, String[] states) throws InterruptedE // [START bigquery_query_params_timestamps] private static void runTimestamp() throws InterruptedException { - BigQuery bigquery = - new BigQueryOptions.DefaultBigqueryFactory().create(BigQueryOptions.getDefaultInstance()); + BigQuery bigquery = BigQueryOptions.getDefaultInstance().getService(); DateTime timestamp = new DateTime(2016, 12, 7, 8, 0, 0, DateTimeZone.UTC); @@ -236,25 +200,9 @@ private static void runTimestamp() throws InterruptedException { .build(); // Execute the query. - QueryResponse response = bigquery.query(queryRequest); - - // Wait for the job to finish (if the query takes more than 10 seconds to complete). - while (!response.jobCompleted()) { - Thread.sleep(1000); - response = bigquery.getQueryResults(response.getJobId()); - } - - // Check for errors. - if (response.hasErrors()) { - String firstError = ""; - if (response.getExecutionErrors().size() != 0) { - firstError = response.getExecutionErrors().get(0).getMessage(); - } - throw new RuntimeException(firstError); - } + TableResult result = bigquery.query(queryRequest); // Print all pages of the results. - QueryResult result = response.getResult(); DateTimeFormatter formatter = ISODateTimeFormat.dateTimeNoMillis().withZoneUTC(); while (result != null) { for (List row : result.iterateAll()) { diff --git a/bigquery/cloud-client/src/main/java/com/example/bigquery/QuerySample.java b/bigquery/cloud-client/src/main/java/com/example/bigquery/QuerySample.java index ef00c6cc698..26e182fc8b4 100644 --- a/bigquery/cloud-client/src/main/java/com/example/bigquery/QuerySample.java +++ b/bigquery/cloud-client/src/main/java/com/example/bigquery/QuerySample.java @@ -23,9 +23,8 @@ import com.google.cloud.bigquery.JobId; import com.google.cloud.bigquery.JobInfo; import com.google.cloud.bigquery.QueryJobConfiguration; -import com.google.cloud.bigquery.QueryResponse; -import com.google.cloud.bigquery.QueryResult; import com.google.cloud.bigquery.TableId; +import com.google.cloud.bigquery.TableResult; import java.io.IOException; import java.util.List; import java.util.UUID; @@ -137,8 +136,7 @@ public static void runQuery(QueryJobConfiguration queryConfig) } // Get the results. - QueryResponse response = bigquery.getQueryResults(jobId); - QueryResult result = response.getResult(); + TableResult result = queryJob.getQueryResults(); // Print all pages of the results. while (result != null) { diff --git a/bigquery/cloud-client/src/main/java/com/example/bigquery/SimpleApp.java b/bigquery/cloud-client/src/main/java/com/example/bigquery/SimpleApp.java index 4b5179ceb5b..37a278984ad 100644 --- a/bigquery/cloud-client/src/main/java/com/example/bigquery/SimpleApp.java +++ b/bigquery/cloud-client/src/main/java/com/example/bigquery/SimpleApp.java @@ -27,7 +27,7 @@ import com.google.cloud.bigquery.JobInfo; import com.google.cloud.bigquery.QueryJobConfiguration; import com.google.cloud.bigquery.QueryResponse; -import com.google.cloud.bigquery.QueryResult; +import com.google.cloud.bigquery.TableResult; import java.util.UUID; // [END bigquery_simple_app_deps] @@ -71,7 +71,7 @@ public static void main(String... args) throws Exception { // Get the results. QueryResponse response = bigquery.getQueryResults(jobId); - QueryResult result = response.getResult(); + TableResult result = queryJob.getQueryResults(); // Print all pages of the results. for (FieldValueList row : result.iterateAll()) {