Skip to content

Commit

Permalink
style changes
Browse files Browse the repository at this point in the history
  • Loading branch information
wenchengl committed Nov 9, 2018
2 parents 23ddf69 + 65061d2 commit bfca35d
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,5 @@ classes
local.properties
.vagrant
dependency-reduced-pom.xml
.DS_Store

14 changes: 8 additions & 6 deletions src/main/java/com/github/susom/dbgoodies/etl/BigQueryWriter.java
Original file line number Diff line number Diff line change
Expand Up @@ -320,11 +320,11 @@ private InsertAllRequest.RowToInsert createInsertFromDbArgs(Row r) {
}
}

if(entryIdFields!=null && entryIdFields.length>0)
if(entryIdFields!=null && entryIdFields.length>0) {
return InsertAllRequest.RowToInsert.of(getRowId(row), row);
else
}else {
return InsertAllRequest.RowToInsert.of(row);

}
}

private String getRowId(Map<String, Object> row){
Expand Down Expand Up @@ -389,10 +389,12 @@ public T process(Rows rs) throws Exception {
totalCnt.addAndGet(batchInsertData.size());
long timeTook = (Instant.now().getEpochSecond()-lastBatchStartTs);
long totalTimeTook = Instant.now().getEpochSecond() - startTs;
if(timeTook!=0)
log.info("db "+tableName+" total:"+totalCnt.get()+" time "+timeTook+" s speed:"+ totalCnt.get()/totalTimeTook +" r/s");
else
if(timeTook!=0) {
log.info("db " + tableName + " total:" + totalCnt.get() + " time " + timeTook
+ " s speed:" + totalCnt.get() / totalTimeTook + " r/s");
}else {
System.out.print("*");
}

lastBatchStartTs = Instant.now().getEpochSecond() ;
batchByteSize = 0;
Expand Down

0 comments on commit bfca35d

Please sign in to comment.