Google bigquery bigquery的行命名问题

Google bigquery bigquery的行命名问题,google-bigquery,Google Bigquery,我有 将行命名为“f”时 什么步骤会重现问题 "Can not set java.util.List field com.google.api.services.bigquery.model.TableRow.f to java.lang.String" 预期产量是多少?你看到了什么 将列重命名为smth。像f1一样可以 渐变依赖项: TableRow row = new TableRow(); row.set("f", 7.7); TableDataInsertAllRequest.Rows

我有

将行命名为“f”时

什么步骤会重现问题

"Can not set java.util.List field com.google.api.services.bigquery.model.TableRow.f to java.lang.String"
预期产量是多少?你看到了什么

将列重命名为smth。像f1一样可以

渐变依赖项:

TableRow row = new TableRow();
row.set("f", 7.7);
TableDataInsertAllRequest.Rows rows = new TableDataInsertAllRequest.Rows();
rows.setInsertId(timestamp);
rows.setJson(row);
List  rowList = new ArrayList();
rowList.add(rows);
TableDataInsertAllRequest content =  new TableDataInsertAllRequest().setRows(rowList);
TableDataInsertAllResponse response = bigquery.tabledata().insertAll(
        projectId, datasetId, tableId, content).execute();

由于TableRow中可以有多个字段,我通常会看到以下结构:

dependencies {
    compile project(':shared')
    compile 'com.google.api-client:google-api-client:1.19.0'
    compile 'com.google.http-client:google-http-client:1.19.0'
    compile 'com.google.http-client:google-http-client-jackson2:1.19.0'
    compile 'com.google.oauth-client:google-oauth-client:1.19.0'
    compile 'com.google.oauth-client:google-oauth-client-servlet:1.19.0'
    compile 'com.google.apis:google-api-services-bigquery:v2-rev171-1.19.0'
    compile 'redis.clients:jedis:2.4.2'
    compile 'com.fasterxml.jackson.core:jackson-core:2.4.4'
    compile 'com.fasterxml.jackson.core:jackson-databind:2.4.4'
    compile 'log4j:log4j:1.2.16'
    compile 'org.json:json:20090211'
    compile 'com.google.api-client:google-api-client:1.17.0-rc'
    compile 'com.google.guava:guava:15.0'
    compile 'org.glassfish.jersey.core:jersey-server:2.10.1'
    compile 'org.glassfish.jersey.core:jersey-client:2.10.1'
    compile 'org.glassfish.jersey.containers:jersey-container-servlet:2.10.1'
    compile 'org.glassfish.jersey.containers:jersey-container-jetty-servlet:2.10.1'
    compile 'org.glassfish.jersey.media:jersey-media-json-jackson:2.10.1'
    compile 'javax.servlet:javax.servlet-api:3.1.0'
    compile 'com.jayway.jsonpath:json-path-assert:0.9.1'
    compile 'com.googlecode.json-simple:json-simple:1.1.1'
    compile 'redis.clients:jedis:2.4.2'
    compile 'com.github.fge:json-schema-validator:2.2.5'
    compile 'org.eclipse.jetty:jetty-server:9.2.1.v20140609'
    compile 'org.mongodb:mongo-java-driver:2.12.0'
    compile 'com.google.code.gson:gson:2.2.4'
    compile 'org.apache.commons:commons-email:1.3.3'
    testCompile 'org.mockito:mockito-all:1.9.5'

}
TableDataInsertAllResponse=bigquery.tabledata()
.insertAll(projectId、datasetId、tableId、新TableDataInsertAllRequest()
.setRows(ImmutableList.of(新的TableDataInsertAllRequest.Rows()
.setInsertId(insertId)
.setJson(新的ImmutableMap.Builder()
.付诸表决(“f”,7.7)
.build()).execute();
这对你有用吗


请注意,我在该示例中包括一个insertId,因为如果/当您添加重试逻辑时,您将希望使用它进行行级重复数据消除。如果您的用例不需要它,现在可以随意删除它。

这实际上适用于BigQuery UI。。。。因此,也许可以先用UI创建表,然后使用代码将数据上传到表中?当您用任何其他字符串替换“f”时,相同的代码是否有效?@FelipeHoffa当我使用“f1”而不是“f”时,它对我有效.实际上,在调试之后,我发现类com.google.api.services.bigquery.model.TableRow具有私有属性java.util.List f,据我所知,该属性阻止创建名为f的行,并抛出java.lang.IllegalArgumentException:无法将java.util.List字段com.google.api.services.bigquery.model.TableRow.f设置为java.lang.String
TableDataInsertAllResponse response = bigquery.tabledata()
    .insertAll(projectId, datasetId, tableId, new TableDataInsertAllRequest()
        .setRows(ImmutableList.of(new TableDataInsertAllRequest.Rows()
            .setInsertId(insertId)
            .setJson(new ImmutableMap.Builder<String, Object>()
                .put("f", 7.7)
                .build())))).execute();