autumnust commented on a change in pull request #3278:
URL: https://github.com/apache/gobblin/pull/3278#discussion_r632069357



##########
File path: 
gobblin-hive-registration/src/main/java/org/apache/gobblin/hive/writer/HiveMetadataWriter.java
##########
@@ -95,20 +95,21 @@ public HiveMetadataWriter(State state) throws IOException {
   @Override
   public void flush(String dbName, String tableName) throws IOException {
     String tableKey = tableNameJoiner.join(dbName, tableName);
-    log.info("start to flush table: " + tableKey);
-    HashMap<List<String>, ListenableFuture<Void>> executionMap =
-        this.currentExecutionMap.computeIfAbsent(tableKey, s -> new 
HashMap<>());
-    //iterator all execution to get the result to make sure they all succeeded
-    for (HashMap.Entry<List<String>, ListenableFuture<Void>> execution : 
executionMap.entrySet()) {
-      try {
-        execution.getValue().get(timeOutSeconds, TimeUnit.SECONDS);
-      } catch (InterruptedException | ExecutionException | TimeoutException e) 
{
-        log.error("Error when getting the result of registration for table" + 
tableKey);
-        throw new RuntimeException(e);
+    if(this.currentExecutionMap.containsKey(tableKey)) {
+      log.info("start to flush table: " + tableKey);
+      HashMap<List<String>, ListenableFuture<Void>> executionMap = 
this.currentExecutionMap.get(tableKey);

Review comment:
       just to my own understanding, what the key (typed as `List<String`) 
here? 

##########
File path: 
gobblin-hive-registration/src/main/java/org/apache/gobblin/hive/writer/HiveMetadataWriter.java
##########
@@ -95,20 +95,21 @@ public HiveMetadataWriter(State state) throws IOException {
   @Override
   public void flush(String dbName, String tableName) throws IOException {
     String tableKey = tableNameJoiner.join(dbName, tableName);
-    log.info("start to flush table: " + tableKey);
-    HashMap<List<String>, ListenableFuture<Void>> executionMap =
-        this.currentExecutionMap.computeIfAbsent(tableKey, s -> new 
HashMap<>());
-    //iterator all execution to get the result to make sure they all succeeded
-    for (HashMap.Entry<List<String>, ListenableFuture<Void>> execution : 
executionMap.entrySet()) {
-      try {
-        execution.getValue().get(timeOutSeconds, TimeUnit.SECONDS);
-      } catch (InterruptedException | ExecutionException | TimeoutException e) 
{
-        log.error("Error when getting the result of registration for table" + 
tableKey);
-        throw new RuntimeException(e);
+    if(this.currentExecutionMap.containsKey(tableKey)) {
+      log.info("start to flush table: " + tableKey);
+      HashMap<List<String>, ListenableFuture<Void>> executionMap = 
this.currentExecutionMap.get(tableKey);
+      //iterator all execution to get the result to make sure they all 
succeeded
+      for (HashMap.Entry<List<String>, ListenableFuture<Void>> execution : 
executionMap.entrySet()) {
+        try {
+          execution.getValue().get(timeOutSeconds, TimeUnit.SECONDS);
+        } catch (InterruptedException | ExecutionException | TimeoutException 
e) {
+          log.error("Error when getting the result of registration for table" 
+ tableKey);
+          throw new RuntimeException(e);

Review comment:
       They could be combined as 
   ```throw new RuntimeException("xxx", e)``` ? 




-- 
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.

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


Reply via email to