Fondamentalmente il mio codice è simile esempio ufficiale al https://cloud.google.com/bigquery/streaming-data-into-bigqueryinserire i dati nella tabella BigQuery
Il mio codice:
TableRow data = new TableRow();
data.set("type", eventType);
data.set("timestamp", new Date());
TableDataInsertAllRequest.Rows row = new TableDataInsertAllRequest.Rows();
row.setInsertId(System.currentTimeMillis());
row.setJson(data);
request = new TableDataInsertAllRequest();
request.setRows(Arrays.asList(row));
TableDataInsertAllResponse response = bigquery.tabledata().insertAll(projectId, datasetId, tableId, request).execute();
for (TableDataInsertAllResponse.InsertErrors err: response.getInsertErrors()) {
for (ErrorProto ep: err.getErrors()) {
log.error(ep.getReason() + " : " + ep.getMessage() + " at " + ep.getLocation());
}
}
Ma io ottenere errore:
invalid : JSON map specified for non-record field at null
Sembra che io abbia perso qualcosa , ma non ho idea di cosa c'è di sbagliato nel mio codice. Ho due campi, uno String
e Date
e il messaggio di errore non ha alcun senso per me.
Come inserire i dati nella tabella BigQuery?
Ciao, puoi rispondere a questa domanda http://stackoverflow.com/questions/40481371/io-exception-while-inserting-data-in-table-on-big-query –