rdblue commented on code in PR #7880:
URL: https://github.com/apache/iceberg/pull/7880#discussion_r1337885203


##########
core/src/main/java/org/apache/iceberg/view/ViewMetadata.java:
##########
@@ -270,6 +270,11 @@ private int addVersionInternal(ViewVersion version) {
           "Cannot add version with unknown schema: %s",
           version.schemaId());
 
+      for (Map.Entry<String, Long> entry : 
sqlDialectFrequency(version).entrySet()) {

Review Comment:
   This seems a bit complex since it builds a map. Why not just loop over the 
dialects once and catch the first duplicate?
   
   ```java
         Set<String> dialects = Sets.newHashSet();
         for (ViewRepresentation repr : version.representations()) {
           if (repr instanceof SQLViewRepresentation) {
             SQLViewRepresentation sql = (SQLViewRepresentation) repr;
             Preconditions.checkArgument(
                 dialects.add(sql.dialect()),
                 "Invalid version: cannot contain multiple queries for dialect 
%s",
                 sql.dialect());
           }
         }
   ```



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