gavinchou commented on code in PR #37490:
URL: https://github.com/apache/doris/pull/37490#discussion_r1668538113


##########
fe/fe-core/src/main/java/org/apache/doris/fs/obj/AzureObjStorage.java:
##########
@@ -299,17 +299,36 @@ private String constructS3Path(String fileName, String 
bucket) throws UserExcept
         return String.format("s3://%s/%s", bucket, fileName);
     }
 
+    public static String getLongestPrefix(String globPattern) {
+        int length = globPattern.length();
+        int earliestSpecialCharIndex = length;
+
+        char[] specialChars = {'*', '?', '[', '{', '\\'};
+        
+        for (char specialChar : specialChars) {
+            int index = globPattern.indexOf(specialChar);
+            if (index != -1 && index < earliestSpecialCharIndex) {
+                earliestSpecialCharIndex = index;
+            }
+        }
+
+        return globPattern.substring(0, earliestSpecialCharIndex);
+    }
+
     public Status globList(String remotePath, List<RemoteFile> result, boolean 
fileNameOnly) {
         try {
             S3URI uri = S3URI.create(remotePath, isUsePathStyle, 
forceParsingByStandardUri);
             String globPath = uri.getKey();
+            String bucket = uri.getBucket();
             LOG.info("try to glob list for azure, remote path {}, orig {}", 
globPath, remotePath);
-            BlobContainerClient client = 
getClient().getBlobContainerClient(uri.getBucket());
+            BlobContainerClient client = 
getClient().getBlobContainerClient(bucket);
             java.nio.file.Path pathPattern = Paths.get(globPath);
             LOG.info("path pattern {}", pathPattern.toString());
             PathMatcher matcher = 
FileSystems.getDefault().getPathMatcher("glob:" + pathPattern.toString());
 
-            ListBlobsOptions options = new 
ListBlobsOptions().setPrefix(globPath);
+            String listPrefix = getLongestPrefix(globPath);

Review Comment:
   `a/b/*/c/*/d`
   a/b list 



##########
fe/fe-core/src/main/java/org/apache/doris/fs/obj/AzureObjStorage.java:
##########
@@ -299,17 +299,36 @@ private String constructS3Path(String fileName, String 
bucket) throws UserExcept
         return String.format("s3://%s/%s", bucket, fileName);
     }
 
+    public static String getLongestPrefix(String globPattern) {
+        int length = globPattern.length();
+        int earliestSpecialCharIndex = length;
+
+        char[] specialChars = {'*', '?', '[', '{', '\\'};

Review Comment:
   `a/*/b*c/**/d*.csv`



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to