Cherry-picked from #45408 Co-authored-by: wuwenchi <wuwenchi@selectdb.com>
This commit is contained in:
committed by
GitHub
parent
7d32e4f71f
commit
90ca889f84
@ -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
|
||||
|
||||
@ -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());
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user