zhangfengcdt commented on code in PR #5935:
URL: https://github.com/apache/datafusion-comet/pull/5935#discussion_r4016417244


##########
spark/src/main/scala/org/apache/comet/iceberg/IcebergReflection.scala:
##########
@@ -560,6 +562,27 @@ object IcebergReflection extends Logging {
     }
   }
 
+  /**
+   * The FileIO class that actually opens `location`: the delegate a 
`ResolvingFileIO` picks for
+   * it (`ResolvingFileIO.ioClass`), or the FileIO's own class otherwise. 
`None` on reflection
+   * failure; callers must fail closed.
+   */
+  def resolveFileIOClass(fileIO: Any, location: String): Option[Class[_]] =
+    if (!classNameInHierarchy(fileIO.getClass, 
Set(ClassNames.RESOLVING_FILE_IO))) {
+      Some(fileIO.getClass)
+    } else {
+      try {
+        val ioClassMethod = getMethod(fileIO.getClass, "ioClass", 
classOf[String])
+        Option(ioClassMethod.invoke(fileIO, location).asInstanceOf[Class[_]])

Review Comment:
   Good catch! It should be fixed now and the helper calls 
`ResolvingFileIO.io(location)` using reflection and checks the class it 
actually initiates.



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to