aokolnychyi commented on code in PR #6655:
URL: https://github.com/apache/iceberg/pull/6655#discussion_r1093717093


##########
core/src/main/java/org/apache/iceberg/hadoop/Util.java:
##########
@@ -84,10 +84,16 @@ public static String[] blockLocations(FileIO io, 
ScanTaskGroup<?> taskGroup) {
     return locations.toArray(HadoopInputFile.NO_LOCATION_PREFERENCE);
   }
 
+  public static boolean isHDFSLocation(FileIO io, String location) {
+    return io instanceof HadoopFileIO
+        || (io instanceof ResolvingFileIO
+            && 
ResolvingFileIO.implFromLocation(location).equals(HadoopFileIO.class.getName()));
+  }
+
   private static String[] blockLocations(FileIO io, ContentScanTask<?> task) {
-    InputFile inputFile = io.newInputFile(task.file().path().toString());
-    if (inputFile instanceof HadoopInputFile) {
-      HadoopInputFile hadoopInputFile = (HadoopInputFile) inputFile;
+    String location = task.file().path().toString();
+    if (isHDFSLocation(io, location)) {
+      HadoopInputFile hadoopInputFile = (HadoopInputFile) 
io.newInputFile(location);

Review Comment:
   If we plan to support custom `FileIO` implementations that extend 
`HadoopFileIO`, this cast may be not safe.



-- 
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.

To unsubscribe, e-mail: issues-unsubscr...@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@iceberg.apache.org
For additional commands, e-mail: issues-h...@iceberg.apache.org

Reply via email to