Skip to content

Commit

Permalink
Core: Generalize Util::blockLocations
Browse files Browse the repository at this point in the history
  • Loading branch information
okumin committed Nov 4, 2024
1 parent d9b9768 commit 40fed51
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
6 changes: 6 additions & 0 deletions .palantir/revapi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1100,6 +1100,12 @@ acceptedBreaks:
- code: "java.class.removed"
old: "enum org.apache.iceberg.BaseMetastoreTableOperations.CommitStatus"
justification: "Removing deprecated code"
- code: "java.method.parameterTypeChanged"
old: "parameter java.lang.String[] org.apache.iceberg.hadoop.Util::blockLocations(===org.apache.iceberg.CombinedScanTask===,\
\ org.apache.hadoop.conf.Configuration)"
new: "parameter java.lang.String[] org.apache.iceberg.hadoop.Util::blockLocations(===org.apache.iceberg.ScanTaskGroup<org.apache.iceberg.FileScanTask>===,\
\ org.apache.hadoop.conf.Configuration)"
justification: "False positive - CombinedScanTask is a subclass of ScanTaskGroup<FileScanTask>"
- code: "java.method.removed"
old: "method java.lang.String org.apache.iceberg.FileScanTaskParser::toJson(org.apache.iceberg.FileScanTask)"
justification: "Removing deprecated code"
Expand Down
5 changes: 2 additions & 3 deletions core/src/main/java/org/apache/iceberg/hadoop/Util.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
import org.apache.hadoop.fs.BlockLocation;
import org.apache.hadoop.fs.FileSystem;
import org.apache.hadoop.fs.Path;
import org.apache.iceberg.CombinedScanTask;
import org.apache.iceberg.ContentScanTask;
import org.apache.iceberg.FileScanTask;
import org.apache.iceberg.ScanTask;
Expand Down Expand Up @@ -59,9 +58,9 @@ public static FileSystem getFs(Path path, Configuration conf) {
}
}

public static String[] blockLocations(CombinedScanTask task, Configuration conf) {
public static String[] blockLocations(ScanTaskGroup<FileScanTask> taskGroup, Configuration conf) {
Set<String> locationSets = Sets.newHashSet();
for (FileScanTask f : task.files()) {
for (FileScanTask f : taskGroup.tasks()) {
Path path = new Path(f.file().path().toString());
try {
FileSystem fs = path.getFileSystem(conf);
Expand Down

0 comments on commit 40fed51

Please sign in to comment.