@@ -989,8 +989,7 @@ Page<FieldValueList> listTableData(String datasetId, String tableId,
989989 boolean cancel (JobId jobId );
990990
991991 /**
992- * Runs the query associated with the request, using an internally-generated random JobId. The
993- * returned job is always completed.
992+ * Runs the query associated with the request, using an internally-generated random JobId.
994993 *
995994 * <p>Example of running a query.
996995 *
@@ -1003,11 +1002,7 @@ Page<FieldValueList> listTableData(String datasetId, String tableId,
10031002 * // QueryJobConfiguration queryConfig =
10041003 * // QueryJobConfiguration.newBuilder(query).setUseLegacySql(true).build();
10051004 *
1006- * Job job = bigquery.query(queryConfig);
1007- * if (job.getStatus().getError() != null) {
1008- * // handle errors
1009- * }
1010- * for (FieldValueList row : job.getQueryResults().iterateAll()) {
1005+ * for (FieldValueList row : bigquery.query(queryConfig).iterateAll()) {
10111006 * // do something with the data
10121007 * }
10131008 * }</pre>
@@ -1020,23 +1015,21 @@ Page<FieldValueList> listTableData(String datasetId, String tableId,
10201015 * QueryJobConfiguration queryConfig = QueryJobConfiguration.newBuilder(query)
10211016 * .addPositionalParameter(QueryParameterValue.int64(5))
10221017 * .build();
1023- * Job job = bigquery.query(queryConfig);
1024- * if (job.getStatus().getError() != null) {
1025- * // handle errors
1026- * }
1027- * for (FieldValueList row : job.getQueryResults().iterateAll()) {
1018+ * for (FieldValueList row : bigquery.query(queryConfig).iterateAll()) {
10281019 * // do something with the data
10291020 * }
10301021 * }</pre>
10311022 *
10321023 * @throws BigQueryException upon failure
10331024 * @throws InterruptedException if the current thread gets interrupted while waiting for the query
10341025 * to complete
1026+ * @throws JobException if the job completes unsuccessfully
10351027 */
1036- Job query (QueryJobConfiguration configuration , JobOption ... options ) throws InterruptedException ;
1028+ QueryResult query (QueryJobConfiguration configuration , JobOption ... options )
1029+ throws InterruptedException , JobException ;
10371030
10381031 /**
1039- * Runs the query associated with the request, using the given JobId. The returned job is always completed.
1032+ * Runs the query associated with the request, using the given JobId.
10401033 *
10411034 * <p>See {@link #query(QueryJobConfiguration, JobOption...)} for examples on populating a {@link
10421035 * QueryJobConfiguration}.
@@ -1056,9 +1049,10 @@ Page<FieldValueList> listTableData(String datasetId, String tableId,
10561049 * @throws BigQueryException upon failure
10571050 * @throws InterruptedException if the current thread gets interrupted while waiting for the query
10581051 * to complete
1052+ * @throws JobException if the job completes unsuccessfully
10591053 */
1060- Job query (QueryJobConfiguration configuration , JobId jobId , JobOption ... options )
1061- throws InterruptedException ;
1054+ QueryResult query (QueryJobConfiguration configuration , JobId jobId , JobOption ... options )
1055+ throws InterruptedException , JobException ;
10621056
10631057 /**
10641058 * Returns results of the query associated with the provided job.
0 commit comments