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 ba908fb2cde..21e470ac59b 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 @@ -20,7 +20,7 @@ import com.google.cloud.bigquery.BigQueryOptions; import com.google.cloud.bigquery.FieldValue; import com.google.cloud.bigquery.QueryParameterValue; -import com.google.cloud.bigquery.QueryRequest; +import com.google.cloud.bigquery.QueryJobConfiguration; import com.google.cloud.bigquery.QueryResponse; import com.google.cloud.bigquery.QueryResult; import org.joda.time.DateTime; @@ -122,8 +122,8 @@ private static void runNamed(final String corpus, final long minWordCount) + "WHERE corpus = @corpus\n" + "AND word_count >= @min_word_count\n" + "ORDER BY word_count DESC"; - QueryRequest queryRequest = - QueryRequest.newBuilder(queryString) + QueryJobConfiguration queryRequest = + QueryJobConfiguration.newBuilder(queryString) .addNamedParameter("corpus", QueryParameterValue.string(corpus)) .addNamedParameter("min_word_count", QueryParameterValue.int64(minWordCount)) // Standard SQL syntax is required for parameterized queries. @@ -177,8 +177,8 @@ private static void runArray(String gender, String[] states) throws InterruptedE + "GROUP BY name\n" + "ORDER BY count DESC\n" + "LIMIT 10;"; - QueryRequest queryRequest = - QueryRequest.newBuilder(queryString) + QueryJobConfiguration queryRequest = + QueryJobConfiguration.newBuilder(queryString) .addNamedParameter("gender", QueryParameterValue.string(gender)) .addNamedParameter("states", QueryParameterValue.array(states, String.class)) // Standard SQL syntax is required for parameterized queries. @@ -224,8 +224,8 @@ private static void runTimestamp() throws InterruptedException { DateTime timestamp = new DateTime(2016, 12, 7, 8, 0, 0, DateTimeZone.UTC); String queryString = "SELECT TIMESTAMP_ADD(@ts_value, INTERVAL 1 HOUR);"; - QueryRequest queryRequest = - QueryRequest.newBuilder(queryString) + QueryJobConfiguration queryRequest = + QueryJobConfiguration.newBuilder(queryString) .addNamedParameter( "ts_value", QueryParameterValue.timestamp( diff --git a/bigquery/cloud-client/src/test/java/com/example/bigquery/QuerySampleIT.java b/bigquery/cloud-client/src/test/java/com/example/bigquery/QuerySampleIT.java index a0f7a007aa9..d592277b7a5 100644 --- a/bigquery/cloud-client/src/test/java/com/example/bigquery/QuerySampleIT.java +++ b/bigquery/cloud-client/src/test/java/com/example/bigquery/QuerySampleIT.java @@ -73,7 +73,7 @@ public void tearDown() { @Test public void testSimpleQuery() throws Exception { - QuerySample.main(new String[]{"--query", LEGACY_SQL_QUERY, "--runSimpleQuery"}); + QuerySample.main(new String[]{"--query", STANDARD_SQL_QUERY, "--runSimpleQuery"}); String got = bout.toString(); assertThat(got).contains(CORPUS_NAME); } @@ -87,7 +87,7 @@ public void testStandardSqlQuery() throws Exception { @Test public void testUncachedQuery() throws Exception { - QuerySample.main(new String[]{"--query", LEGACY_SQL_QUERY, "--runSimpleQuery"}); + QuerySample.main(new String[]{"--query", STANDARD_SQL_QUERY, "--runSimpleQuery"}); String got = bout.toString(); assertThat(got).contains(CORPUS_NAME); } @@ -98,7 +98,7 @@ public void testUncachedQuery() throws Exception { // See: https://cloud.google.com/bigquery/querying-data#interactive-batch @Ignore public void testBatchQuery() throws Exception { - QuerySample.main(new String[]{"--query", LEGACY_SQL_QUERY, "--runBatchQuery"}); + QuerySample.main(new String[]{"--query", STANDARD_SQL_QUERY, "--runBatchQuery"}); String got = bout.toString(); assertThat(got).contains(CORPUS_NAME); } @@ -112,7 +112,7 @@ public void testPermanentTableQuery() throws Exception { QuerySample.main( new String[]{ "--query", - LEGACY_SQL_QUERY, + STANDARD_SQL_QUERY, "--runPermanentTableQuery", "--destDataset", TEST_DATASET,