anoopj commented on code in PR #18884:
URL: https://github.com/apache/iceberg/pull/18884#discussion_r4568972204


##########
core/src/test/java/org/apache/iceberg/TestV4ScanPlanning.java:
##########
@@ -0,0 +1,165 @@
+/*
+ * 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;
+
+import static org.apache.iceberg.V4TestHelpers.dataFile;
+import static org.apache.iceberg.V4TestHelpers.dataFileWithStats;
+import static org.apache.iceberg.V4TestHelpers.writeTrackedFiles;
+import static org.apache.iceberg.types.Types.NestedField.optional;
+import static org.assertj.core.api.Assertions.assertThat;
+
+import java.io.File;
+import java.io.IOException;
+import org.apache.iceberg.io.CloseableIterable;
+import org.apache.iceberg.io.OutputFile;
+import org.apache.iceberg.relocated.com.google.common.collect.ImmutableList;
+import org.apache.iceberg.relocated.com.google.common.collect.ImmutableMap;
+import org.apache.iceberg.types.Types;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.io.TempDir;
+
+class TestV4ScanPlanning {
+  private static final Schema SCHEMA =
+      new Schema(
+          optional(1, "id", Types.IntegerType.get()), optional(2, "data", 
Types.StringType.get()));
+  private static final Types.StructType EMPTY_PARTITION = 
Types.StructType.of();
+  private static final PartitionData EMPTY_PARTITION_DATA = new 
PartitionData(EMPTY_PARTITION);
+  private static final int UNPARTITIONED_SPEC_ID = 
PartitionSpec.unpartitioned().specId();
+  private static final Types.StructType STATS_TYPE =
+      StatsUtil.statsWriteSchema(SCHEMA, MetricsConfig.from(ImmutableMap.of(), 
SCHEMA, null));
+  private static final String FILE_A = 
"s3://bucket/db/table/data/file-a.parquet";
+  private static final String FILE_B = 
"s3://bucket/db/table/data/file-b.parquet";
+
+  @TempDir private File tableDir;
+
+  @AfterEach
+  void cleanup() {
+    TestTables.clearTables();
+  }
+
+  @Test
+  void rootManifestSnapshotPlansThroughFilePlanner() throws IOException {
+    TestTables.TestTable table =
+        TestTables.create(tableDir, "v4_root", SCHEMA, 
PartitionSpec.unpartitioned(), 4);
+
+    commitRootManifestSnapshot(
+        table,
+        dataFile(FILE_A, UNPARTITIONED_SPEC_ID, EMPTY_PARTITION_DATA),
+        dataFile(FILE_B, UNPARTITIONED_SPEC_ID, EMPTY_PARTITION_DATA));
+
+    try (CloseableIterable<FileScanTask> tasks = table.newScan().planFiles()) {
+      assertThat(tasks)
+          .extracting(task -> task.file().location())
+          .as("the scan should plan the root manifest's data files via the v4 
planner")
+          .containsExactlyInAnyOrder(FILE_A, FILE_B);
+    }
+  }
+
+  @Test
+  void retainedManifestListSnapshotStaysOnLegacyPath() throws IOException {

Review Comment:
   Renamed to `readsManifestListSnapshotAfterUpgradeToV4`



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