mas-chen commented on code in PR #5410:
URL: https://github.com/apache/iceberg/pull/5410#discussion_r946269357


##########
flink/v1.15/flink/src/main/java/org/apache/iceberg/flink/sink/IcebergStreamWriter.java:
##########
@@ -97,7 +98,12 @@ public String toString() {
         .toString();
   }
 
-  private void emit(WriteResult result) {
+  /** close all open files and emit files to downstream committer operator */
+  private void flush() throws IOException {
+    long startNano = System.nanoTime();
+    WriteResult result = writer.complete();
+    writerMetrics.updateFlushResult(result);
     output.collect(new StreamRecord<>(result));
+    
writerMetrics.flushDuration(TimeUnit.NANOSECONDS.toMillis(System.nanoTime() - 
startNano));

Review Comment:
   Maybe it is clearer and better to avoid unnecessary conversion by using 
System.currentTimeMillis() and millis for the calculations since there is no 
extra precision from doing it in nanoseconds? Unless you want the extra 
precision, for which the return type long wouldn't suffice. Ditto on the 
similar instances to this calculation



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to