Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Core: Generalize Util::blockLocations #11053

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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