Skip to content

Commit

Permalink
[HUDI-5097] Fix partition reading without partition fields table conf…
Browse files Browse the repository at this point in the history
…ig (apache#7069)

Revert to FSUtils.getAllPartitionPaths to load partitions properly. Details in apache#6016 (comment)

Only for 0.12.2 to keep behavior consistent over patch releases
  • Loading branch information
xushiyan authored Dec 15, 2022
1 parent 6fa192a commit 492f7d7
Showing 1 changed file with 1 addition and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ protected List<PartitionPath> getAllQueryPartitionPaths() {

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

private List<String> getAllPartitionPathsUnchecked() {
try {
return isPartitionedTable() ? tableMetadata.getAllPartitionPaths() : Collections.singletonList("");
} catch (IOException e) {
throw new HoodieIOException("Failed to fetch partition paths for a table", e);
}
}

private void validate(HoodieTimeline activeTimeline, Option<String> queryInstant) {
if (shouldValidateInstant) {
if (queryInstant.isPresent() && !activeTimeline.containsInstant(queryInstant.get())) {
Expand Down Expand Up @@ -366,10 +358,6 @@ private void resetTableMetadata(HoodieTableMetadata newTableMetadata) {
tableMetadata = newTableMetadata;
}

private boolean isPartitionedTable() {
return partitionColumns.length > 0 || HoodieTableMetadata.isMetadataTable(basePath.toString());
}

public static final class PartitionPath {

final String path;
Expand Down

0 comments on commit 492f7d7

Please sign in to comment.