Ver código fonte

[Fix][UDF] Fix udf jar path not exist when fs.defaultFS starts with file:/// (#4692)

Shiwen Cheng 4 anos atrás
pai
commit
03c7e1f368

+ 2 - 4
dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/utils/UDFUtils.java

@@ -73,13 +73,11 @@ public class UDFUtils {
         String resourceFullName;
         Set<Map.Entry<UdfFunc,String>> entries = udfFuncTenantCodeMap.entrySet();
         for (Map.Entry<UdfFunc,String> entry:entries){
+            String prefixPath = defaultFS.startsWith("file://") ? "file://" : defaultFS;
             String uploadPath = HadoopUtils.getHdfsUdfDir(entry.getValue());
-            if (!uploadPath.startsWith("hdfs:")) {
-                uploadPath = defaultFS + uploadPath;
-            }
             resourceFullName = entry.getKey().getResourceName();
             resourceFullName = resourceFullName.startsWith("/") ? resourceFullName : String.format("/%s",resourceFullName);
-            sqls.add(String.format("add jar %s%s", uploadPath, resourceFullName));
+            sqls.add(String.format("add jar %s%s%s", prefixPath, uploadPath, resourceFullName));
         }
 
     }