Google bigquery 重复记录-嵌套和重复数据-Java API

Google bigquery 重复记录-嵌套和重复数据-Java API,google-bigquery,Google Bigquery,我正在尝试使用JavaAPI对重复记录字段进行流式处理。它插入记录,但包含空值。我使用的数据和模式来自google的“嵌套和重复数据”示例 以下是代码片段: TableRow row = new TableRow(); row.set("kind", "person"); row.set("fullName", "P"); row.set("age", "22"); row.set("gender", "M"); Tab

我正在尝试使用JavaAPI对重复记录字段进行流式处理。它插入记录,但包含空值。我使用的数据和模式来自google的“嵌套和重复数据”示例

以下是代码片段:

      TableRow row = new TableRow();
      row.set("kind", "person");
      row.set("fullName", "P");
      row.set("age", "22");
      row.set("gender", "M");


      TableRow prow = new TableRow();
      prow.set("areaCode", 206);
      prow.set("number", 1234567);       
      row.set("phoneNumber", prow);

      JsonArray children = new JsonArray();

      JsonObject child1 = new JsonObject();
      child1.addProperty("name", "Jane");
      child1.addProperty("gender", "f");
      child1.addProperty("age", 6);       
      children.add(child1);

      JsonObject child2 = new JsonObject();
      child2.addProperty("name", "John");
      child2.addProperty("gender", "m");
      child2.addProperty("age", 15);          
      children.add(child2);

      row.set("children", children);


      TableDataInsertAllRequest.Rows rows = new TableDataInsertAllRequest.Rows();         
      rows.setJson(row);

      List  rowList = new ArrayList();
      rowList.add(rows);
      TableDataInsertAllRequest content = new TableDataInsertAllRequest().setRows(rowList);
      TableDataInsertAllResponse response = bigquery.tabledata().insertAll(projectId, "tmp", "person5", content).execute();

创建列表的过程如下所示,而不是JsonArray:

List<TableRow> children = new ArrayList<TableRow>();

TableRow child1 = new TableRow();
child1.set("name", "Jane");
child1.set("gender", "f");
child1.set("age", 6);       

TableRow child2 = new TableRow();
child2.set("name", "John");
child2.set("gender", "m");
child2.set("age", 15);

children.add(child1);
children.add(child2);
List children=new ArrayList();
TableRow child1=新建TableRow();
儿童1.集合(“姓名”、“简”);
儿童1.集合(“性别”、“f”);
儿童1.集合(“年龄”,6岁);
TableRow child2=新的TableRow();
儿童2.集合(“姓名”、“约翰”);
儿童2.集合(“性别”、“m”);
儿童2.集合(“年龄”,15岁);
添加(child1);
添加(child2);

是否打印响应中的错误?我认为问题出在JsonObject上,请尝试在那里使用
TableRow
,如
prow
,或
row
。如果我这样做,它会抛出一个错误“JsonArray是必需的”