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


##########
core/src/test/java/org/apache/iceberg/TestFilePlanner.java:
##########
@@ -0,0 +1,677 @@
+/*
+ * 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.types.Types.NestedField.optional;
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.assertj.core.api.Assertions.assertThatThrownBy;
+import static org.assertj.core.api.Assertions.tuple;
+
+import java.io.IOException;
+import java.util.List;
+import java.util.Locale;
+import java.util.Map;
+import java.util.concurrent.ExecutorService;
+import java.util.function.UnaryOperator;
+import org.apache.iceberg.expressions.Expressions;
+import org.apache.iceberg.inmemory.InMemoryFileIO;
+import org.apache.iceberg.io.CloseableIterable;
+import org.apache.iceberg.io.FileAppender;
+import org.apache.iceberg.io.InputFile;
+import org.apache.iceberg.io.OutputFile;
+import org.apache.iceberg.metrics.DefaultMetricsContext;
+import org.apache.iceberg.metrics.ScanMetrics;
+import org.apache.iceberg.relocated.com.google.common.collect.ImmutableList;
+import org.apache.iceberg.relocated.com.google.common.collect.ImmutableMap;
+import org.apache.iceberg.relocated.com.google.common.collect.Iterables;
+import org.apache.iceberg.relocated.com.google.common.collect.Lists;
+import org.apache.iceberg.transforms.Transforms;
+import org.apache.iceberg.types.Types;
+import org.apache.iceberg.util.LocationUtil;
+import org.apache.iceberg.util.ThreadPools;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.params.ParameterizedTest;
+import org.junit.jupiter.params.provider.FieldSource;
+
+class TestFilePlanner {

Review Comment:
   Revised test plan:
   
   | Test | Purpose |
   |------|---------|
   | **1. Layouts (parallel execution)** | |
   | `rootWithOnlyDataFiles` | A root with only data entries produces one task 
per file and no deletes. |
   | `rootWithOnlyLeafManifests` | A root with two leaf manifests expands both 
and emits all of their files. |
   | `rootWithMixedDataAndLeafManifests` | A root that mixes data files and 
leaf manifests returns the root files together with the expanded leaf files. |
   | **2. Filtering + case sensitivity** | |
   | `filterSkipsAndMatchesRootDataFilesAndManifests` | A filter applied at the 
root keeps and skips both data files and manifest references. |
   | `filterSkipsAndMatchesLeafDataFiles` | A filter is forwarded into an 
opened leaf, where it keeps the matching data files and skips the rest. |
   | `filterHonorsCaseSensitivity` | The same filter written with a differently 
cased column name still works once case sensitivity is turned off, which shows 
the setting reaches the reader. |
   | **3. File-to-task conversion** | |
   | `colocatedDvAttachedAsPositionDeleteFile` | A data entry with a colocated 
deletion vector produces a task whose delete is a POSITION_DELETES file with 
the right fields. |
   | `residualForMixedPartitionedAndUnpartitioned` | On a manifest that mixes a 
partitioned and an unpartitioned file, the id predicate drops out of the 
partitioned file's residual because its partition already satisfies it, but it 
stays in the unpartitioned file's residual. |
   | `ignoreResidualsProducesAlwaysTrueResidual` | Running the same case with 
ignoreResiduals turned on leaves every task with an alwaysTrue residual. |
   | **4. Table location** | |
   | `tableLocationForwardedToRootAndLeafReaders` | Relative file paths resolve 
against the table location, confirming it reaches both the root reader and the 
leaf readers. |
   | **5. Lazy evaluation** | |
   | `closingWithoutIteratingOpensOnlyRoot` | A recording FileIO shows that 
building the plan and closing it without iterating opens only the root. |
   | `leafOpenedOnlyWhenPrecedingLeafExhausted` | With no executor, the second 
leaf is not opened until the first one has been fully read. |
   | **6. Negative cases** | |
   | `deleteManifestInRootUnsupported` | A delete manifest in the root makes 
planning fail. |
   | `v3ManifestLeafUnsupported` | A v3 manifest used as a leaf makes planning 
fail. |
   | **7. Scan metrics** | |
   | `scanMetricsForComplexFilteredPlan` | Checks the counts for result and 
skipped data files, scanned and skipped data manifests, deletion vectors versus 
indexed delete files, and the total file and delete sizes. |
   



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