kasakrisz commented on a change in pull request #1561:
URL: https://github.com/apache/hive/pull/1561#discussion_r503620025



##########
File path: 
ql/src/java/org/apache/hadoop/hive/ql/metadata/HiveMaterializedViewsRegistry.java
##########
@@ -292,35 +277,12 @@ public void refreshMaterializedView(HiveConf conf, Table 
oldMaterializedViewTabl
       return;
     }
 
-    // We are going to create the map for each view in the given database
-    ConcurrentMap<String, RelOptMaterialization> dbMap =
-        new ConcurrentHashMap<String, RelOptMaterialization>();
-    // If we are caching the MV, we include it in the cache
-    final ConcurrentMap<String, RelOptMaterialization> prevDbMap = 
materializedViews.putIfAbsent(
-        materializedViewTable.getDbName(), dbMap);
-    if (prevDbMap != null) {
-      dbMap = prevDbMap;
-    }
     final RelOptMaterialization newMaterialization = 
createMaterialization(conf, materializedViewTable);
     if (newMaterialization == null) {
       return;
     }
-    dbMap.compute(materializedViewTable.getTableName(), new BiFunction<String, 
RelOptMaterialization, RelOptMaterialization>() {
-      @Override
-      public RelOptMaterialization apply(String tableName, 
RelOptMaterialization existingMaterialization) {
-        if (existingMaterialization == null) {
-          // If it was not existing, we just create it
-          return newMaterialization;
-        }
-        Table existingMaterializedViewTable = 
HiveMaterializedViewUtils.extractTable(existingMaterialization);
-        if (existingMaterializedViewTable.equals(oldMaterializedViewTable)) {
-          // If the old version is the same, we replace it
-          return newMaterialization;
-        }
-        // Otherwise, we return existing materialization
-        return existingMaterialization;
-      }
-    });
+    materializedViews.refresh(oldMaterializedViewTable, materializedViewTable, 
newMaterialization);
+;

Review comment:
       Removed




----------------------------------------------------------------
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:
us...@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: gitbox-unsubscr...@hive.apache.org
For additional commands, e-mail: gitbox-h...@hive.apache.org

Reply via email to