amogh-jahagirdar commented on code in PR #9414:
URL: https://github.com/apache/iceberg/pull/9414#discussion_r1450860911


##########
core/src/main/java/org/apache/iceberg/view/ViewVersionReplace.java:
##########
@@ -56,30 +63,71 @@ public ViewVersion apply() {
   }
 
   ViewMetadata internalApply() {
-    Preconditions.checkState(
-        !representations.isEmpty(), "Cannot replace view without specifying a 
query");
-    Preconditions.checkState(null != schema, "Cannot replace view without 
specifying schema");
-    Preconditions.checkState(
-        null != defaultNamespace, "Cannot replace view without specifying a 
default namespace");
-
     this.base = ops.refresh();
 
+    if (fieldNameToDocChanges.isEmpty()) {
+      Preconditions.checkState(
+          !representations.isEmpty(), "Cannot replace view without specifying 
a query");
+      Preconditions.checkState(null != schema, "Cannot replace view without 
specifying schema");
+      Preconditions.checkState(
+          null != defaultNamespace, "Cannot replace view without specifying a 
default namespace");
+    } else {
+      Preconditions.checkState(
+          representations.isEmpty(), "Cannot change column docs and replace 
representations");
+      Preconditions.checkState(
+          null == schema, "Cannot change column docs and also explicitly 
change schema");
+      Preconditions.checkState(
+          null == defaultNamespace, "Cannot change column docs and change 
default namespace");

Review Comment:
   I need to add some tests which exercise these Preconditions checks



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