szehon-ho commented on a change in pull request #4005:
URL: https://github.com/apache/iceberg/pull/4005#discussion_r808661327



##########
File path: core/src/main/java/org/apache/iceberg/PartitionsTable.java
##########
@@ -167,16 +175,30 @@ Partition get(StructLike key) {
     private final StructLike key;
     private long recordCount;
     private int fileCount;
+    private int deleteFileCount;
+    private long equalityDeleteCount;
+    private long positionDeleteCount;
 
     Partition(StructLike key) {
       this.key = key;
       this.recordCount = 0;
       this.fileCount = 0;
+      this.deleteFileCount = 0;
+      this.equalityDeleteCount = 0L;
+      this.positionDeleteCount = 0L;
     }
 
-    void update(DataFile file) {
-      this.recordCount += file.recordCount();
+    void update(FileScanTask task) {
+      this.recordCount += task.file().recordCount();
       this.fileCount += 1;
+      this.deleteFileCount += task.deletes().size();

Review comment:
       Would this ever have duplicates?  Example multiple fileScanTask within 
the same partition referring to the same delete file, can it happen?

##########
File path: core/src/main/java/org/apache/iceberg/PartitionsTable.java
##########
@@ -48,7 +48,10 @@
     this.schema = new Schema(
         Types.NestedField.required(1, "partition", 
table.spec().partitionType()),
         Types.NestedField.required(2, "record_count", Types.LongType.get()),
-        Types.NestedField.required(3, "file_count", Types.IntegerType.get())
+        Types.NestedField.required(3, "file_count", Types.IntegerType.get()),
+        Types.NestedField.required(4, "delete_file_count", 
Types.IntegerType.get()),
+        Types.NestedField.required(5, "equality_delete_count", 
Types.LongType.get()),

Review comment:
       There might be a little confusion in the name (I thought it means the 
equality_delete_files and position_delete_files count at first).  Maybe we can 
change to "equality_delete_record_count" and "position_delete_record_count".
   
   Not sure what others think 

##########
File path: core/src/main/java/org/apache/iceberg/PartitionsTable.java
##########
@@ -167,16 +172,25 @@ Partition get(StructLike key) {
     private final StructLike key;
     private long recordCount;
     private int fileCount;
+    private int deleteFileCount;
 
     Partition(StructLike key) {
       this.key = key;
       this.recordCount = 0;
       this.fileCount = 0;

Review comment:
       Yea, this does seem like it should be renamed "file_count" to 
"data_file_count" if we can...(not sure the policy here), agree the original 
name is unfortunate.

##########
File path: core/src/test/java/org/apache/iceberg/TestPartitionTableScans.java
##########
@@ -0,0 +1,145 @@
+/*
+ * 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 java.io.File;
+import java.io.IOException;
+import java.util.List;
+import org.apache.hadoop.conf.Configuration;
+import org.apache.iceberg.expressions.Expression;
+import org.apache.iceberg.expressions.Expressions;
+import org.apache.iceberg.hadoop.HadoopTables;
+import org.apache.iceberg.relocated.com.google.common.collect.Lists;
+import org.apache.iceberg.types.Types;
+import org.apache.iceberg.util.StructProjection;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.rules.TemporaryFolder;
+
+import static org.apache.iceberg.TableTestBase.FILE_A;
+import static org.apache.iceberg.TableTestBase.FILE_A2_DELETES;
+import static org.apache.iceberg.TableTestBase.FILE_A_DELETES;
+import static org.apache.iceberg.TableTestBase.FILE_B;
+import static org.apache.iceberg.TableTestBase.FILE_B_DELETES;
+import static org.apache.iceberg.types.Types.NestedField.required;
+
+public class TestPartitionTableScans {

Review comment:
       Any reason we can't extend TableTestBase, or even put this in 
"TestMetadataTableScans"?




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