本文整理汇总了Java中com.google.api.services.bigquery.Bigquery.Jobs.GetQueryResults类的典型用法代码示例。如果您正苦于以下问题:Java GetQueryResults类的具体用法?Java GetQueryResults怎么用?Java GetQueryResults使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
GetQueryResults类属于com.google.api.services.bigquery.Bigquery.Jobs包,在下文中一共展示了GetQueryResults类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: run
import com.google.api.services.bigquery.Bigquery.Jobs.GetQueryResults; //导入依赖的package包/类
public static Iterator<GetQueryResultsResponse> run(final String queryString,
final String projId, final long wTime, final long maxRows, boolean useLegacySql)
throws IOException {
try {
logger.info("Use legacy sql: {}", useLegacySql);
QueryResponse query;
query = service
.jobs()
.query(
projId,
new QueryRequest().setTimeoutMs(wTime)
.setUseLegacySql(useLegacySql).setQuery(queryString)
.setMaxResults(maxRows)).execute();
jobId = query.getJobReference().getJobId();
projectId = query.getJobReference().getProjectId();
GetQueryResults getRequest = service.jobs().getQueryResults(
projectId,
jobId);
return getPages(getRequest);
} catch (IOException ex) {
throw ex;
}
}
示例2: run
import com.google.api.services.bigquery.Bigquery.Jobs.GetQueryResults; //导入依赖的package包/类
public static Iterator<GetQueryResultsResponse> run(String projectId,
String queryString,
long waitTime) throws IOException{
Bigquery bigquery = BigqueryServiceFactory.getService();
//Wait until query is done with 10 second timeout, at most 5 retries on error
QueryResponse query = bigquery.jobs().query(
projectId,
new QueryRequest().setTimeoutMs(waitTime).setQuery(queryString)).execute();
//Make a request to get the results of the query
//(timeout is zero since job should be complete)
GetQueryResults getRequest = bigquery.jobs().getQueryResults(
query.getJobReference().getProjectId(),
query.getJobReference().getJobId());
return getPages(getRequest);
}
示例3: run
import com.google.api.services.bigquery.Bigquery.Jobs.GetQueryResults; //导入依赖的package包/类
public static Iterator<GetQueryResultsResponse> run(String projectId,
String queryString,
boolean batch,
long waitTime)
throws IOException, InterruptedException{
Bigquery bigquery = BigqueryServiceFactory.getService();
Job query = asyncQuery(bigquery, projectId, queryString, batch);
Bigquery.Jobs.Get getRequest = bigquery.jobs().get(
projectId, query.getJobReference().getJobId());
//Poll every waitTime milliseconds,
//retrying at most retries times if there are errors
pollJob(getRequest, waitTime);
GetQueryResults resultsRequest = bigquery.jobs().getQueryResults(
projectId, query.getJobReference().getJobId());
return getPages(resultsRequest);
}