JingsongLi commented on code in PR #11247:
URL: https://github.com/apache/paimon/pull/11247#discussion_r4623726709


##########
paimon-filesystems/paimon-jindo/src/main/java/org/apache/paimon/jindo/HadoopCompliantFileIO.java:
##########
@@ -466,9 +488,31 @@ public void close() throws IOException {
     private static class HadoopFileStatus implements FileStatus {
 
         private final org.apache.hadoop.fs.FileStatus status;
+        @Nullable private final org.apache.hadoop.fs.Path listedDirectory;
 
         private HadoopFileStatus(org.apache.hadoop.fs.FileStatus status) {
+            this(status, null);
+        }
+
+        private HadoopFileStatus(
+                org.apache.hadoop.fs.FileStatus status,
+                @Nullable org.apache.hadoop.fs.Path listedDirectory) {
             this.status = status;
+            this.listedDirectory = listedDirectory;
+        }
+
+        @Nullable
+        @Override
+        public String getStorageClass() {
+            // Listing a single file can return a basic status with a default 
storage class.
+            if (listedDirectory != null
+                    && status instanceof JindoHadoopFileStatus
+                    && status.isFile()
+                    && listedDirectory.equals(status.getPath().getParent())) {

Review Comment:
   [P2] Normalize the listed directory before comparing its child path
   
   `new Path(URI.create("oss://bucket/dir/"))` preserves the trailing slash 
through `HadoopCompliantFileIO.path` and Hadoop `makeQualified`. Jindo 6.9.1 
canonicalizes the directory and returns `oss://bucket/dir` as the child's 
parent. That makes this equality false in both `listStatus` and 
`listStatusIterative`, so an Archive file is reported with no storage class. I 
reproduced it with a Jindo SDK `Archive` file status fed to this exact wrapper. 
The wrapper returned `null` with the URI trailing slash and `Archive` with the 
normalized path. Please normalize the requested URI with the same Path rules as 
the SDK and cover both listing entry points.



-- 
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]

Reply via email to