kbuci commented on code in PR #18172:
URL: https://github.com/apache/hudi/pull/18172#discussion_r2875140640
##########
hudi-client/hudi-spark-client/src/test/java/org/apache/hudi/client/clustering/plan/strategy/TestSparkSizeBasedClusteringPlanStrategy.java:
##########
@@ -82,11 +82,36 @@ public void testBuildClusteringGroup() {
Assertions.assertEquals(1,
clusteringGroups.get(1).getNumOutputFileGroups());
}
+ @Test
+ public void testRemaningFileInPartitionNotClustered() {
+ HoodieWriteConfig config = HoodieWriteConfig.newBuilder()
+ .withPath("")
+ .withClusteringConfig(HoodieClusteringConfig.newBuilder()
+
.withClusteringPlanStrategyClass(SparkSizeBasedClusteringPlanStrategy.class.getName())
+ .withClusteringMaxBytesInGroup(2000)
+ .withClusteringTargetFileMaxBytes(1000)
+ .withClusteringPlanSmallFileLimit(500)
+ .withSingleGroupClusteringEnabled(false)
+ .build())
+ .build();
+
+ SparkSizeBasedClusteringPlanStrategy planStrategy = new
SparkSizeBasedClusteringPlanStrategy(table, context, config);
+
+ ArrayList<FileSlice> fileSlices = new ArrayList<>();
+ fileSlices.add(createFileSlice(200));
+
+ Stream<HoodieClusteringGroup> clusteringGroupStream =
(Stream<HoodieClusteringGroup>)
planStrategy.buildClusteringGroupsForPartition("p0", fileSlices).getLeft();
+ List<HoodieClusteringGroup> clusteringGroups =
clusteringGroupStream.collect(Collectors.toList());
+
+ // The only file in partition should not be clustered
+ Assertions.assertEquals(0, clusteringGroups.size());
Review Comment:
Added test
--
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]