nastra commented on code in PR #8678:
URL: https://github.com/apache/iceberg/pull/8678#discussion_r1346975335


##########
core/src/main/java/org/apache/iceberg/view/ViewMetadata.java:
##########
@@ -321,14 +321,20 @@ private int reuseOrCreateNewViewVersionId(ViewVersion 
viewVersion) {
 
     /**
      * Checks whether the given view versions would behave the same while 
ignoring the view version
-     * id, the creation timestamp, and the summary.
+     * id, the creation timestamp, and the operation.
      *
      * @param one the view version to compare
      * @param two the view version to compare
      * @return true if the given view versions would behave the same
      */
     private boolean sameViewVersion(ViewVersion one, ViewVersion two) {
-      return Objects.equals(one.representations(), two.representations())
+      // ignore the "operation" contained in the summary for the comparison
+      Map<String, String> summaryOne = Maps.newHashMap(one.summary());
+      Map<String, String> summaryTwo = Maps.newHashMap(two.summary());
+      summaryOne.remove("operation");
+      summaryTwo.remove("operation");
+      return Objects.equals(summaryOne, summaryTwo)
+          && Objects.equals(one.representations(), two.representations())

Review Comment:
   if the SQL is different, then both view versions will be treated separately 
and won't be de-duplicated. But if a create+replace operation creates a view 
version with the same SQL, then this is de-duplicated and only one of those 
remains.



-- 
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: issues-unsubscr...@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


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

Reply via email to