0
FILENAMEからログを挿入するのに次のコードを使用しています。ログファイルには1000sの行が含まれています。新しいラインが数秒で追加されています。しかし、このコードを実行すると、結果として得られるテーブルの奇数行は15-20しかありません。Bigquery InsertAllが期待どおりに機能しない
Rows dfpadunit = new TableDataInsertAllRequest.Rows();
List<Rows> dfpadunits = new ArrayList<Rows>();
TableDataInsertAllRequest content = new TableDataInsertAllRequest();
content.setIgnoreUnknownValues(true);
content.setSkipInvalidRows(true);
reader = new BufferedReader(new FileReader(FILENAME));
while(running) {
while ((line = reader.readLine()) != null) {
TableRow aRow = new TableRow();
aRow.set("RAW_DATA", line);
String time = BigqueryUtils.getCurrentYYMMDDHHMM();
aRow.set("TIME", time);
dfpadunit.setJson(aRow);
dfpadunit.setInsertId(time);
dfpadunits.add(dfpadunit);
}
if(dfpadunits.size() > 0) {
content.setRows(dfpadunits);
TableDataInsertAllResponse response = BQUtils.run(PRE_STG_DATA_SET_ID, DESTINATION_TABLE, content);
dfpadunits.clear();
if(response != null) {
formatTable();
}
}
System.out.println("About to sleep");
Thread.sleep(1000 * 60);
}
BigQueryでテーブルのサイズを確認するにはどうすればよいですか? –
単純な選択カウント(*)。私は1日後もこれを試しましたが、それはまだ同じでした。 –
インサートは重複排除キーとして使用されます。現在の時刻を挿入IDとして使用しています。これは、同じ分のすべての挿入物に同じ除外キーを使用することを意味します。最後のものだけが存続します。挿入IDを空のままにするか、ランダムに生成されたIDを挿入ID –