rdblue commented on a change in pull request #1124:
URL: https://github.com/apache/iceberg/pull/1124#discussion_r445023516
##########
File path: core/src/main/java/org/apache/iceberg/hadoop/HadoopInputFile.java
##########
@@ -169,6 +174,24 @@ public FileStatus getStat() {
return lazyStat();
}
+ public Path getPath() {
+ return path;
+ }
+
+ public String[] getBlockLocations(long start, long end) {
+ List<String> hosts = Lists.newArrayList();
+ try {
+ for (BlockLocation location : fs.getFileBlockLocations(path, start,
end)) {
+ Collections.addAll(hosts, location.getHosts());
+ }
+
+ return hosts.toArray(NO_LOCATION_PREFERENCE);
Review comment:
Yeah, it is odd how this API works, but when you pass in an array with
fewer elements than you need, it will allocate a new one for you that is the
right size. So we pass in a 0-element array. If you just call `toArray`, Java
won't get the type right. The streams API allows passing in an array
constructor (`String[]::new`), but it seems awkward to create a stream when
there's already a working, although awkward, API call for it.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]