amogh-jahagirdar commented on code in PR #9620: URL: https://github.com/apache/iceberg/pull/9620#discussion_r1488225269
########## core/src/main/java/org/apache/iceberg/view/ViewMetadata.java: ########## @@ -510,5 +529,29 @@ static List<ViewHistoryEntry> updateHistory(List<ViewHistoryEntry> history, Set< private <U extends MetadataUpdate> Stream<U> changes(Class<U> updateClass) { return changes.stream().filter(updateClass::isInstance).map(updateClass::cast); } + + private void checkIfDialectIsDropped(ViewVersion previous, ViewVersion current) { + Set<String> baseDialects = sqlDialectsFor(previous); + Set<String> updatedDialects = sqlDialectsFor(current); + + Preconditions.checkState( + updatedDialects.containsAll(baseDialects), + "Cannot replace view due to loss of view dialects (%s=false):\nPrevious dialects: %s\nNew dialects: %s", + ViewProperties.REPLACE_DROP_DIALECT_ALLOWED, + baseDialects, + updatedDialects); + } + + private Set<String> sqlDialectsFor(ViewVersion viewVersion) { + Set<String> dialects = Sets.newHashSet(); + for (ViewRepresentation repr : viewVersion.representations()) { + if (repr instanceof SQLViewRepresentation) { + SQLViewRepresentation sql = (SQLViewRepresentation) repr; + dialects.add(sql.dialect()); Review Comment: Should this be sql.dialect().toLowerCase() to be case-insensitive? -- 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