xushiyan commented on a change in pull request #2621:
URL: https://github.com/apache/hudi/pull/2621#discussion_r587949226



##########
File path: 
hudi-utilities/src/main/java/org/apache/hudi/utilities/sources/helpers/DatePartitionPathSelector.java
##########
@@ -130,20 +140,19 @@ public DatePartitionPathSelector(TypedProperties props, 
Configuration hadoopConf
           FileSystem fs = new Path(path).getFileSystem(serializedConf.get());
           return listEligibleFiles(fs, new Path(path), 
lastCheckpointTime).stream();
         }, partitionsListParallelism);
-    // sort them by modification time.
-    
eligibleFiles.sort(Comparator.comparingLong(FileStatus::getModificationTime));
+    // sort them by modification time ascending.
+    List<FileStatus> sortedEligibleFiles = eligibleFiles.stream()
+        
.sorted(Comparator.comparingLong(FileStatus::getModificationTime)).collect(Collectors.toList());

Review comment:
       @yanghua yes it resulted in this error
   
   ```
   java.lang.UnsupportedOperationException
        at java.util.AbstractList.set(AbstractList.java:132)
        at java.util.AbstractList$ListItr.set(AbstractList.java:426)
        at java.util.List.sort(List.java:482)
        at 
org.apache.hudi.utilities.sources.helpers.DatePartitionPathSelector.getNextFilePathsAndMaxModificationTime(DatePartitionPathSelector.java:141)
        at 
org.apache.hudi.utilities.sources.ParquetDFSSource.fetchNextBatch(ParquetDFSSource.java:48)
        at 
org.apache.hudi.utilities.sources.RowSource.fetchNewData(RowSource.java:43)
        at org.apache.hudi.utilities.sources.Source.fetchNext(Source.java:75)
        at 
org.apache.hudi.utilities.deltastreamer.SourceFormatAdapter.fetchNewDataInRowFormat(SourceFormatAdapter.java:94)
        at 
org.apache.hudi.utilities.deltastreamer.DeltaSync.readFromSource(DeltaSync.java:338)
        at 
org.apache.hudi.utilities.deltastreamer.DeltaSync.syncOnce(DeltaSync.java:255)
        at 
org.apache.hudi.utilities.deltastreamer.HoodieDeltaStreamer$DeltaSyncService.lambda$startService$0(HoodieDeltaStreamer.java:587)
   ```
   `org.apache.hudi.client.common.HoodieSparkEngineContext#flatMap` returns a 
list that can't be sorted in-place.




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

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


Reply via email to