Skip to content

Commit 8947cc5

Browse files
committed
[lake/hudi] optimize HudiSplitPlanner
1 parent 01c2c97 commit 8947cc5

1 file changed

Lines changed: 19 additions & 16 deletions

File tree

fluss-lake/fluss-lake-hudi/src/main/java/org/apache/fluss/lake/hudi/source/HudiSplitPlanner.java

Lines changed: 19 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -71,13 +71,10 @@ public List<HudiSplit> plan() throws IOException {
7171
hudiTableInfo.getEngineContext(), hudiTableInfo.getMetaClient(), false);
7272
if (partitionPaths.isEmpty()) {
7373
if (hudiTableInfo.isPartitioned()) {
74-
LOG.debug(
75-
"No Hudi partition paths discovered for partitioned table {} at instant {}.",
76-
tablePath,
77-
snapshotTime);
7874
LOG.info(
79-
"Planned no Hudi splits for partitioned table {} at instant {} because no Hudi partition paths were discovered.",
75+
"Planned no Hudi splits for partitioned table {} with table type {} at instant {} because no Hudi partition paths were discovered.",
8076
tablePath,
77+
hudiTableInfo.getTableType(),
8178
snapshotTime);
8279
return Collections.emptyList();
8380
} else {
@@ -125,18 +122,24 @@ private List<HudiSplit> planPartition(
125122
splits.add(toHudiSplit(hudiTableInfo, partitionPath, fileSlice));
126123
}
127124
return splits;
125+
} else if (hudiTableInfo.getTableType() == HoodieTableType.COPY_ON_WRITE) {
126+
List<HoodieBaseFile> baseFiles =
127+
fileSystemView
128+
.getLatestBaseFilesBeforeOrOn(partitionPath, snapshotTime)
129+
.collect(Collectors.toList());
130+
for (HoodieBaseFile baseFile : baseFiles) {
131+
splits.add(
132+
toHudiSplit(
133+
hudiTableInfo,
134+
partitionPath,
135+
toFileSlice(partitionPath, baseFile)));
136+
}
137+
return splits;
128138
}
129-
130-
List<HoodieBaseFile> baseFiles =
131-
fileSystemView
132-
.getLatestBaseFilesBeforeOrOn(partitionPath, snapshotTime)
133-
.collect(Collectors.toList());
134-
for (HoodieBaseFile baseFile : baseFiles) {
135-
splits.add(
136-
toHudiSplit(
137-
hudiTableInfo, partitionPath, toFileSlice(partitionPath, baseFile)));
138-
}
139-
return splits;
139+
throw new IOException(
140+
String.format(
141+
"Unsupported Hudi table type %s for table %s.",
142+
hudiTableInfo.getTableType(), tablePath));
140143
}
141144

142145
private FileSlice toFileSlice(String partitionPath, HoodieBaseFile baseFile) {

0 commit comments

Comments
 (0)