BigQuery JDBC驱动程序不会返回超过100,000行 [英] BigQuery JDBC driver won't return more than 100,000 rows

查看:121
本文介绍了BigQuery JDBC驱动程序不会返回超过100,000行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Pentaho PDI中为Google BigQuery使用starschema JDBC驱动程序:

http://code.google.com/p/starschema-bigquery-jdbc/



我的通过BigQuery Web Console查询返回129,993行,但是当我通过JDBC驱动程序执行相同的查询时,它只返回100,000行。是否有某种选项或限制,我不知道?

解决方案

StarSchema代码看起来像只返回第一页结果。



这里的代码这里应该被更新以获得其余的结果。它应该看起来像这样:

  public static GetQueryResultsResponse getQueryResults(Bigquery bigquery,
String projectId,Job completedJob)throws IOException {
GetQueryResultsResponse queryResult = bigquery.jobs()
.getQueryResults(projectId,
completedJob.getJobReference()。getJobId())。execute(); ()queryResult.getRows()。size()){
queryResult.getRows()。addAll(
bigquery.jobs()
) getQueryResults(projectId,
completedJob.getJobReference()。getJobId())
.setStartIndex(queryResult.getRows()。size())
.execute()
.getRows ));
}
返回queryResult;
}


I am using the starschema JDBC driver for Google BigQuery in Pentaho PDI:

http://code.google.com/p/starschema-bigquery-jdbc/

My query through the BigQuery Web Console returns 129,993 rows, but when I execute the same query through the JDBC driver it only returns 100,000 rows. Is there some kind of option or limit that I am not aware of?

解决方案

The StarSchema code looks like it is only returning the first page of results.

The code here here should be updated to get the rest of the results. It should look something like:

public static GetQueryResultsResponse getQueryResults(Bigquery bigquery,
        String projectId, Job completedJob) throws IOException {        
    GetQueryResultsResponse queryResult = bigquery.jobs()
            .getQueryResults(projectId,
                    completedJob.getJobReference().getJobId()).execute();
    while(queryResult.getTotalRows() > queryResult.getRows().size()) {
        queryResult.getRows().addAll(
            bigquery.jobs()
                .getQueryResults(projectId,
                        completedJob.getJobReference().getJobId())
                .setStartIndex(queryResult.getRows().size())
                .execute()
                .getRows());            
    }
    return queryResult;
}

这篇关于BigQuery JDBC驱动程序不会返回超过100,000行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆