rahil-c commented on code in PR #19677:
URL: https://github.com/apache/hudi/pull/19677#discussion_r3834385729


##########
hudi-utilities/src/main/java/org/apache/hudi/utilities/sources/helpers/unstructured/UnstructuredFilePathSelector.java:
##########
@@ -0,0 +1,227 @@
+/*
+ * 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.hudi.utilities.sources.helpers.unstructured;
+
+import org.apache.hudi.common.config.TypedProperties;
+import org.apache.hudi.common.table.checkpoint.Checkpoint;
+import org.apache.hudi.common.util.Option;
+import org.apache.hudi.common.util.ValidationUtils;
+import org.apache.hudi.common.util.VisibleForTesting;
+import org.apache.hudi.exception.HoodieIOException;
+import org.apache.hudi.hadoop.fs.HadoopFSUtils;
+import org.apache.hudi.utilities.config.DFSPathSelectorConfig;
+
+import com.fasterxml.jackson.databind.JsonNode;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.fasterxml.jackson.databind.node.ObjectNode;
+import org.apache.hadoop.conf.Configuration;
+import org.apache.hadoop.fs.FileStatus;
+import org.apache.hadoop.fs.FileSystem;
+import org.apache.hadoop.fs.Path;
+
+import java.io.IOException;
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Comparator;
+import java.util.List;
+
+import static 
org.apache.hudi.common.table.checkpoint.CheckpointUtils.createCheckpoint;
+import static org.apache.hudi.common.util.ConfigUtils.getIntWithAltKeys;
+import static org.apache.hudi.common.util.ConfigUtils.getStringWithAltKeys;
+import static 
org.apache.hudi.utilities.config.UnstructuredFileSourceConfig.MAX_FILES_PER_BATCH;
+
+/**
+ * Selects the next batch of files for {@code UnstructuredFileDFSSource}.
+ *
+ * <p>Differs from {@link 
org.apache.hudi.utilities.sources.helpers.DFSPathSelector} in three ways
+ * that matter at scale:
+ *
+ * <ul>
+ *   <li>The batch is bounded by file <em>count</em> as well as bytes. A byte 
budget alone never
+ *       bounds the number of files, and file count is what drives driver 
memory and task count.</li>
+ *   <li>The checkpoint carries {@code (modificationTime, lastPath)} rather 
than a bare timestamp,
+ *       so a group of files sharing one modification time can be split across 
syncs without the
+ *       unread remainder being stranded by a {@code mtime > checkpoint} 
filter. Files arriving in
+ *       one bulk upload routinely share a timestamp, and object stores report 
modification times
+ *       at second granularity.</li>
+ *   <li>Selected files are returned as a list of {@code (path, size, 
modificationTime)} rather
+ *       than one comma-joined string. Paths legitimately contain commas, and 
re-splitting on one
+ *       corrupts them.</li>
+ * </ul>
+ */
+public class UnstructuredFilePathSelector implements Serializable {

Review Comment:
   Can you explain to me the pros and cons for why we are moving off of 
DFSPathSelector? If we do not go with file count approach then this class would 
not be useful right?



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

Reply via email to