difin commented on code in PR #5529:
URL: https://github.com/apache/hive/pull/5529#discussion_r1915337884


##########
iceberg/iceberg-handler/src/main/java/org/apache/iceberg/mr/hive/compaction/IcebergCompactionUtil.java:
##########
@@ -0,0 +1,95 @@
+/*
+ * 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.mr.hive.compaction;
+
+import java.util.List;
+import org.apache.iceberg.ContentFile;
+import org.apache.iceberg.DataFile;
+import org.apache.iceberg.DeleteFile;
+import org.apache.iceberg.FileScanTask;
+import org.apache.iceberg.MetadataTableType;
+import org.apache.iceberg.MetadataTableUtils;
+import org.apache.iceberg.PositionDeletesScanTask;
+import org.apache.iceberg.ScanTask;
+import org.apache.iceberg.Table;
+import org.apache.iceberg.io.CloseableIterable;
+import org.apache.iceberg.relocated.com.google.common.collect.Lists;
+
+public class IcebergCompactionUtil {
+
+  private IcebergCompactionUtil() {
+
+  }
+
+  /**
+   * Returns true if:
+   *  1. When the table is unpartitioned.
+   *  2. When partitionPath is not provided and the file belongs to the 
non-latest partition spec.
+   *  3. When partitionPath is provided and the file belongs to the same 
partition.
+   * @param table the iceberg table
+   * @param partitionPath partition path
+   * @param file Data or Delete file
+   */
+  public static boolean doesFileMatchPartition(Table table, String 
partitionPath, ContentFile<?> file) {

Review Comment:
   Updated Javadoc of this method to 
   ```
     /**
      * This method implements a common filter that is used in several places 
in Iceberg compaction code.
      * Its aim is to determine if the provided file needs to be handled when 
compacting a partition whose path is equal to 
      * the provided partitionPath. Returns true when one of the following 
conditions is true, otherwise returns false:
      *  1. table is unpartitioned
      *  2. partitionPath is null and the file belongs to the non-latest 
partition spec
      *  3. partitionPath is not null and the file belongs to the partition 
whose path is the partitionPath
      * @param table the iceberg table
      * @param partitionPath partition path
      * @param file Data or Delete file
      */
   ```
   
   and updated method name to `isHandleFileInCompaction` to better reflect the 
intent of the method.



-- 
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: gitbox-unsubscr...@hive.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: gitbox-unsubscr...@hive.apache.org
For additional commands, e-mail: gitbox-h...@hive.apache.org

Reply via email to