当将日期字段作为对象发送到类型为时间戳的 BigQuery 表时,Google Java API 库不会引发异常,但不会出现数据着陆。检查“InsertAllResponse”响应类型返回包括错误“此字段不是记录”。
例如
Hashmap<String,Object> rowContent = new Hashmap<>();
rowContent.put("Time", new Date());
rowContent.put("Name", "Harry");
Run Code Online (Sandbox Code Playgroud)
进而
BigQuery bq = BigQueryOptions.getDefaultInstance().getService();
TableId tableId = TableId.of(datasetName, tableName);
InsertAllRequest.Builder insertReqBuilder = InsertAllRequest.newBuilder(tableId);
insertReqBuilder.addRow({some string}, row);
InsertAllResponse response = bigquery.insertAll(insertReqBuilder.build());
Run Code Online (Sandbox Code Playgroud)
返回一个response.hasErrors() true。