Skip to content

Commit 492f7d7

Browse files
authored
[HUDI-5097] Fix partition reading without partition fields table config (#7069)
Revert to FSUtils.getAllPartitionPaths to load partitions properly. Details in #6016 (comment) Only for 0.12.2 to keep behavior consistent over patch releases
1 parent 6fa192a commit 492f7d7

File tree

1 file changed

+1
-13
lines changed

1 file changed

+1
-13
lines changed

hudi-common/src/main/java/org/apache/hudi/BaseHoodieTableFileIndex.java

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ protected List<PartitionPath> getAllQueryPartitionPaths() {
186186

187187
// Load all the partition path from the basePath, and filter by the query partition path.
188188
// TODO load files from the queryRelativePartitionPaths directly.
189-
List<String> matchedPartitionPaths = getAllPartitionPathsUnchecked()
189+
List<String> matchedPartitionPaths = FSUtils.getAllPartitionPaths(engineContext, metadataConfig, basePath.toString())
190190
.stream()
191191
.filter(path -> queryRelativePartitionPaths.stream().anyMatch(path::startsWith))
192192
.collect(Collectors.toList());
@@ -331,14 +331,6 @@ private Map<String, FileStatus[]> getAllFilesInPartitionsUnchecked(Collection<St
331331
}
332332
}
333333

334-
private List<String> getAllPartitionPathsUnchecked() {
335-
try {
336-
return isPartitionedTable() ? tableMetadata.getAllPartitionPaths() : Collections.singletonList("");
337-
} catch (IOException e) {
338-
throw new HoodieIOException("Failed to fetch partition paths for a table", e);
339-
}
340-
}
341-
342334
private void validate(HoodieTimeline activeTimeline, Option<String> queryInstant) {
343335
if (shouldValidateInstant) {
344336
if (queryInstant.isPresent() && !activeTimeline.containsInstant(queryInstant.get())) {
@@ -366,10 +358,6 @@ private void resetTableMetadata(HoodieTableMetadata newTableMetadata) {
366358
tableMetadata = newTableMetadata;
367359
}
368360

369-
private boolean isPartitionedTable() {
370-
return partitionColumns.length > 0 || HoodieTableMetadata.isMetadataTable(basePath.toString());
371-
}
372-
373361
public static final class PartitionPath {
374362

375363
final String path;

0 commit comments

Comments
 (0)