aokolnychyi commented on code in PR #9069:
URL: https://github.com/apache/iceberg/pull/9069#discussion_r1393115296


##########
core/src/test/java/org/apache/iceberg/actions/TestSizeBasedRewriter.java:
##########
@@ -0,0 +1,100 @@
+/*
+ * 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 java.util.List;
+import java.util.Map;
+import java.util.Set;
+import org.apache.iceberg.DataFile;
+import org.apache.iceberg.FileScanTask;
+import org.apache.iceberg.MockFileScanTask;
+import org.apache.iceberg.Table;
+import org.apache.iceberg.TableTestBase;
+import org.apache.iceberg.relocated.com.google.common.collect.ImmutableList;
+import org.apache.iceberg.relocated.com.google.common.collect.ImmutableMap;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.junit.runners.Parameterized;
+
+@RunWith(Parameterized.class)
+public class TestSizeBasedRewriter extends TableTestBase {
+
+  @Parameterized.Parameters(name = "formatVersion = {0}")
+  public static Object[] parameters() {
+    return new Object[] {1, 2};
+  }
+
+  public TestSizeBasedRewriter(int formatVersion) {
+    super(formatVersion);
+  }
+
+  @Test
+  public void testSplitSizeLowerBound() {
+    SizeBasedDataFileRewriterImpl rewriter = new 
SizeBasedDataFileRewriterImpl(table);
+
+    FileScanTask task1 = new MockFileScanTask(145L * 1024 * 1024);
+    FileScanTask task2 = new MockFileScanTask(145L * 1024 * 1024);
+    FileScanTask task3 = new MockFileScanTask(145L * 1024 * 1024);
+    FileScanTask task4 = new MockFileScanTask(145L * 1024 * 1024);
+    List<FileScanTask> tasks = ImmutableList.of(task1, task2, task3, task4);
+
+    long minFileSize = 256L * 1024 * 1024;
+    long targetFileSize = 512L * 1024 * 1024;
+    long maxFileSize = 768L * 1024 * 1024;
+
+    Map<String, String> options =
+        ImmutableMap.of(
+            SizeBasedDataRewriter.MIN_FILE_SIZE_BYTES, 
String.valueOf(minFileSize),
+            SizeBasedDataRewriter.TARGET_FILE_SIZE_BYTES, 
String.valueOf(targetFileSize),
+            SizeBasedDataRewriter.MAX_FILE_SIZE_BYTES, 
String.valueOf(maxFileSize));
+    rewriter.init(options);
+
+    // the total task size is 580 bytes and the target file size is 512 bytes

Review Comment:
   Good catch, I updated the logic but forgot the comment. Fixed.



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