ranxianglei commented on code in PR #4497:
URL: https://github.com/apache/paimon/pull/4497#discussion_r1862320580


##########
paimon-common/src/main/java/org/apache/paimon/format/FileFormat.java:
##########
@@ -88,26 +88,15 @@ public static FileFormat fromIdentifier(String identifier, 
Options options) {
 
     /** Create a {@link FileFormat} from format identifier and format options. 
*/
     public static FileFormat fromIdentifier(String identifier, FormatContext 
context) {
-        return fromIdentifier(identifier, context, 
FileFormat.class.getClassLoader())
-                .orElseThrow(
-                        () ->
-                                new RuntimeException(
-                                        String.format(
-                                                "Could not find a 
FileFormatFactory implementation class for %s format",
-                                                identifier)));
-    }
-
-    private static Optional<FileFormat> fromIdentifier(
-            String formatIdentifier, FormatContext context, ClassLoader 
classLoader) {
-        ServiceLoader<FileFormatFactory> serviceLoader =
-                ServiceLoader.load(FileFormatFactory.class, classLoader);
-        for (FileFormatFactory factory : serviceLoader) {
-            if (factory.identifier().equals(formatIdentifier.toLowerCase())) {
-                return Optional.of(factory.create(context));
-            }
+        if (identifier != null) {
+            identifier = identifier.toLowerCase();
         }
-
-        return Optional.empty();
+        FileFormatFactory fileFormatFactory =
+                FactoryUtil.discoverFactory(

Review Comment:
   @JingsongLi  Of course you can, but I’ll change it in a few days. I’ve been 
a little busy lately.
   
   当然可以,不过过几天再改,最近有点忙



-- 
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...@paimon.apache.org

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

Reply via email to