timothyw553 commented on code in PR #19078:
URL: https://github.com/apache/iceberg/pull/19078#discussion_r4708584287


##########
core/src/test/java/org/apache/iceberg/actions/TestRewriteDataFilesCommitManager.java:
##########
@@ -0,0 +1,129 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.iceberg.actions;
+
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.assertj.core.api.Assertions.assertThatThrownBy;
+import static org.junit.jupiter.api.Assumptions.assumeTrue;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
+
+import java.io.IOException;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.util.Set;
+import org.apache.iceberg.DataFile;
+import org.apache.iceberg.DataFiles;
+import org.apache.iceberg.ParameterizedTestExtension;
+import org.apache.iceberg.TestBase;
+import org.apache.iceberg.TestTables;
+import org.apache.iceberg.exceptions.ValidationException;
+import org.junit.jupiter.api.TestTemplate;
+import org.junit.jupiter.api.extension.ExtendWith;
+
+@ExtendWith(ParameterizedTestExtension.class)
+class TestRewriteDataFilesCommitManager extends TestBase {
+  @TestTemplate
+  void expiredStartingSnapshotHasClearError() {
+    table.newAppend().appendFile(FILE_A).commit();
+    long startingSnapshotId = table.currentSnapshot().snapshotId();
+    RewriteDataFilesCommitManager manager =
+        new RewriteDataFilesCommitManager(table, startingSnapshotId);

Review Comment:
   all three tests here implicitly use `useStartingSequenceNumber=true`, so if 
the check moved outside that `if` block none of them would catch it. could we 
pass `true` explicitly in these tests and add one with `false` where the 
rewrite still succeeds?
   
   ```diff
   +  @TestTemplate
   +  void expiredStartingSnapshotAllowsRewriteWithoutStartingSequenceNumber() {
   +    table.newAppend().appendFile(FILE_A).commit();
   +    long startingSnapshotId = table.currentSnapshot().snapshotId();
   +    RewriteDataFilesCommitManager manager =
   +        new RewriteDataFilesCommitManager(table, startingSnapshotId, false);
   +    table.newAppend().appendFile(FILE_B).commit();
   +    table.expireSnapshots().expireSnapshotId(startingSnapshotId).commit();
   +    long snapshotBeforeRewrite = table.currentSnapshot().snapshotId();
   +
   +    manager.commitFileGroups(Set.of(rewriteGroup(FILE_C)));
   +
   +    
assertThat(table.currentSnapshot().snapshotId()).isNotEqualTo(snapshotBeforeRewrite);
   +  }
   ```



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