This is an automated email from the ASF dual-hosted git repository.

morningman pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/doris.git


The following commit(s) were added to refs/heads/master by this push:
     new 36230be7a1e [fix](external)fix split and get the schema (#45408)
36230be7a1e is described below

commit 36230be7a1e7ca17810fef6570346de8a6cbfcb5
Author: wuwenchi <wuwen...@selectdb.com>
AuthorDate: Wed Dec 18 07:57:44 2024 +0800

    [fix](external)fix split and get the schema (#45408)
    
    ### What problem does this PR solve?
    
    Related PR: #39116
    
    Problem Summary:
    
    Split and get the schema according to `://` and `:/`.
    Like `file://ab/c`, `file:/ab/c`
---
 .../main/java/org/apache/doris/common/util/LocationPath.java |  2 +-
 .../java/org/apache/doris/common/util/LocationPathTest.java  | 12 ++++++++++++
 2 files changed, 13 insertions(+), 1 deletion(-)

diff --git 
a/fe/fe-core/src/main/java/org/apache/doris/common/util/LocationPath.java 
b/fe/fe-core/src/main/java/org/apache/doris/common/util/LocationPath.java
index 4604e4deabb..2318532cba6 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/common/util/LocationPath.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/common/util/LocationPath.java
@@ -90,7 +90,7 @@ public class LocationPath {
     private LocationPath(String originLocation, Map<String, String> props, 
boolean convertPath) {
         isBindBroker = props.containsKey(HMSExternalCatalog.BIND_BROKER_NAME);
         String tmpLocation = originLocation;
-        if (!originLocation.contains(SCHEME_DELIM)) {
+        if (!(originLocation.contains(SCHEME_DELIM) || 
originLocation.contains(NONSTANDARD_SCHEME_DELIM))) {
             // Sometimes the file path does not contain scheme, need to add 
default fs
             // eg, /path/to/file.parquet -> hdfs://nn/path/to/file.parquet
             // the default fs is from the catalog properties
diff --git 
a/fe/fe-core/src/test/java/org/apache/doris/common/util/LocationPathTest.java 
b/fe/fe-core/src/test/java/org/apache/doris/common/util/LocationPathTest.java
index 9d1edadd919..4457b7dd1ef 100644
--- 
a/fe/fe-core/src/test/java/org/apache/doris/common/util/LocationPathTest.java
+++ 
b/fe/fe-core/src/test/java/org/apache/doris/common/util/LocationPathTest.java
@@ -205,4 +205,16 @@ public class LocationPathTest {
         String beLocation = locationPath.toStorageLocation().toString();
         Assertions.assertTrue(beLocation.equalsIgnoreCase("/path/to/local"));
     }
+
+    @Test
+    public void testLocalFileSystem() {
+        HashMap<String, String> props = new HashMap<>();
+        props.put("fs.defaultFS", "hdfs:///xyz");
+        LocationPath p1 = new LocationPath("file:///abc/def", props);
+        Assertions.assertEquals(Scheme.LOCAL, p1.getScheme());
+        LocationPath p2 = new LocationPath("file:/abc/def", props);
+        Assertions.assertEquals(Scheme.LOCAL, p2.getScheme());
+        LocationPath p3 = new LocationPath("file://authority/abc/def", props);
+        Assertions.assertEquals(Scheme.LOCAL, p3.getScheme());
+    }
 }


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

Reply via email to