deniskuzZ commented on code in PR #4079:
URL: https://github.com/apache/hive/pull/4079#discussion_r1126090936


##########
ql/src/java/org/apache/hadoop/hive/ql/metadata/Hive.java:
##########
@@ -2101,6 +2102,41 @@ public boolean 
validateMaterializedViewsFromRegistry(List<Table> cachedMateriali
     }
   }
 
+  private Materialization 
getMaterializationInvalidationInfo(MaterializedViewMetadata metadata)
+      throws TException, HiveException {
+    MaterializationSnapshot mvSnapshot = 
MaterializationSnapshot.fromJson(metadata.creationMetadata.getValidTxnList());
+    if (mvSnapshot.getTableSnapshots() == null || 
mvSnapshot.getTableSnapshots().isEmpty()) {
+      return getMSC().getMaterializationInvalidationInfo(
+          metadata.creationMetadata, conf.get(ValidTxnList.VALID_TXNS_KEY));
+    }
+
+    boolean hasDelete = false;
+    for (SourceTable sourceTable : metadata.getSourceTables()) {
+      Table table = getTable(sourceTable.getTable().getDbName(), 
sourceTable.getTable().getTableName());
+      HiveStorageHandler storageHandler = table.getStorageHandler();
+      if (storageHandler == null) {
+        Materialization materialization = new Materialization();
+        materialization.setSourceTablesCompacted(true);
+        return materialization;
+      }
+      Boolean b = storageHandler.hasDeleteOperation(
+          table, 
mvSnapshot.getTableSnapshots().get(table.getFullyQualifiedName()));
+      if (b == null) {
+        Materialization materialization = new Materialization();
+        materialization.setSourceTablesCompacted(true);
+        return materialization;
+      } else if (b) {
+        hasDelete = true;

Review Comment:
   should we `break` the loop here?



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