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

lide 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 507dfd8b7ed [Improvement](multicatalog) support read tencent dlc table 
on lakefs (#36823)
507dfd8b7ed is described below

commit 507dfd8b7ed73d7d0cfd211fe64edde3cf916c9e
Author: Yulei-Yang <yulei.yang0...@gmail.com>
AuthorDate: Thu Jun 27 12:02:51 2024 +0800

    [Improvement](multicatalog) support read tencent dlc table on lakefs 
(#36823)
---
 .../main/java/org/apache/doris/common/FeConstants.java    |  1 +
 .../java/org/apache/doris/common/util/LocationPath.java   | 15 +++++++++++++++
 .../doris/datasource/property/PropertyConverter.java      |  3 ++-
 .../doris/datasource/property/PropertyConverterTest.java  |  2 +-
 4 files changed, 19 insertions(+), 2 deletions(-)

diff --git a/fe/fe-core/src/main/java/org/apache/doris/common/FeConstants.java 
b/fe/fe-core/src/main/java/org/apache/doris/common/FeConstants.java
index 9567304be2f..1c24ca69d4f 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/common/FeConstants.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/common/FeConstants.java
@@ -74,6 +74,7 @@ public class FeConstants {
     public static final String FS_PREFIX_BOS = "bos";
     public static final String FS_PREFIX_COS = "cos";
     public static final String FS_PREFIX_COSN = "cosn";
+    public static final String FS_PREFIX_LAKEFS = "lakefs";
     public static final String FS_PREFIX_OBS = "obs";
     public static final String FS_PREFIX_OFS = "ofs";
     public static final String FS_PREFIX_GFS = "gfs";
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 dd1641126bf..eccb483578a 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
@@ -62,6 +62,7 @@ public class LocationPath {
         COSN, // Tencent
         OFS, // Tencent CHDFS
         GFS, // Tencent GooseFs,
+        LAKEFS, // used by Tencent DLC
         OSS, // Alibaba,
         OSS_HDFS, // JindoFS on OSS
         JFS, // JuiceFS,
@@ -163,6 +164,10 @@ public class LocationPath {
                     locationType = LocationType.COSN;
                     this.location = location;
                     break;
+                case FeConstants.FS_PREFIX_LAKEFS:
+                    locationType = LocationType.COSN;
+                    this.location = normalizedLakefsPath(location);
+                    break;
                 case FeConstants.FS_PREFIX_VIEWFS:
                     locationType = LocationType.VIEWFS;
                     this.location = location;
@@ -277,6 +282,15 @@ public class LocationPath {
         }
     }
 
+    private static String normalizedLakefsPath(String location) {
+        int atIndex = location.indexOf("@dlc");
+        if (atIndex != -1) {
+            return "lakefs://" + location.substring(atIndex + 1);
+        } else {
+            return location;
+        }
+    }
+
     public static Pair<FileSystemType, String> getFSIdentity(String location, 
String bindBrokerName) {
         LocationPath locationPath = new LocationPath(location);
         FileSystemType fsType = (bindBrokerName != null) ? 
FileSystemType.BROKER : locationPath.getFileSystemType();
@@ -351,6 +365,7 @@ public class LocationPath {
             case GCS:
                 // ATTN, for COSN, on FE side, use HadoopFS to access, but on 
BE, use S3 client to access.
             case COSN:
+            case LAKEFS:
                 // now we only support S3 client for object storage on BE
                 return TFileType.FILE_S3;
             case HDFS:
diff --git 
a/fe/fe-core/src/main/java/org/apache/doris/datasource/property/PropertyConverter.java
 
b/fe/fe-core/src/main/java/org/apache/doris/datasource/property/PropertyConverter.java
index fd0c8846029..9b9a92f7f32 100644
--- 
a/fe/fe-core/src/main/java/org/apache/doris/datasource/property/PropertyConverter.java
+++ 
b/fe/fe-core/src/main/java/org/apache/doris/datasource/property/PropertyConverter.java
@@ -195,7 +195,7 @@ public class PropertyConverter {
             return OBSFileSystem.class.getName();
         } else if (fsScheme.equalsIgnoreCase("oss")) {
             return AliyunOSSFileSystem.class.getName();
-        } else if (fsScheme.equalsIgnoreCase("cosn")) {
+        } else if (fsScheme.equalsIgnoreCase("cosn") || 
fsScheme.equalsIgnoreCase("lakefs")) {
             return CosFileSystem.class.getName();
         } else {
             return S3AFileSystem.class.getName();
@@ -361,6 +361,7 @@ public class PropertyConverter {
         cosProperties.put(CosNConfigKeys.COSN_ENDPOINT_SUFFIX_KEY, 
props.get(CosProperties.ENDPOINT));
         cosProperties.put("fs.cosn.impl.disable.cache", "true");
         cosProperties.put("fs.cosn.impl", getHadoopFSImplByScheme("cosn"));
+        cosProperties.put("fs.lakefs.impl", getHadoopFSImplByScheme("lakefs"));
         if (credential.isWhole()) {
             cosProperties.put(CosNConfigKeys.COSN_USERINFO_SECRET_ID_KEY, 
credential.getAccessKey());
             cosProperties.put(CosNConfigKeys.COSN_USERINFO_SECRET_KEY_KEY, 
credential.getSecretKey());
diff --git 
a/fe/fe-core/src/test/java/org/apache/doris/datasource/property/PropertyConverterTest.java
 
b/fe/fe-core/src/test/java/org/apache/doris/datasource/property/PropertyConverterTest.java
index 4e4b0408641..b31b79de783 100644
--- 
a/fe/fe-core/src/test/java/org/apache/doris/datasource/property/PropertyConverterTest.java
+++ 
b/fe/fe-core/src/test/java/org/apache/doris/datasource/property/PropertyConverterTest.java
@@ -470,7 +470,7 @@ public class PropertyConverterTest extends 
TestWithFeService {
                     + "    'cos.secret_key' = 'skk'\n"
                     + ");";
         testS3CompatibleCatalogProperties(catalogName0, 
CosProperties.COS_PREFIX,
-                "cos.ap-beijing.myqcloud.com", query0, 12, 17);
+                "cos.ap-beijing.myqcloud.com", query0, 12, 18);
 
         String catalogName1 = "hms_oss";
         String query1 = "create catalog " + catalogName1 + " properties (\n"


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

Reply via email to