HyunWooZZ commented on issue #1952:
URL: 
https://github.com/apache/iceberg-python/issues/1952#issuecomment-2851220164

   I think this might be the clue that’s worth digging into further:
   https://github.com/apache/arrow/blob/main/cpp/src/arrow/filesystem/gcsfs.cc
   
   ``` c++
     Result<FileInfo> GetFileInfo(const GcsPath& path) {
       if (path.object.empty()) {
         auto meta = client_.GetBucketMetadata(path.bucket);
         return GetFileInfoBucket(path, std::move(meta).status());
       }
       auto meta = client_.GetObjectMetadata(path.bucket, path.object);
       Result<FileInfo> info = GetFileInfoObject(path, meta);
       if (!info.ok() || info->type() != FileType::NotFound) {
         return info;
       }
       // Not found case.  It could be this was written to GCS with a different
       // "Directory" convention, so if there is at least one object that
       // matches the prefix we assume it is a directory.
       std::string canonical = internal::EnsureTrailingSlash(path.object);
       auto list_result = client_.ListObjects(path.bucket, 
gcs::Prefix(canonical));
       if (list_result.begin() != list_result.end()) {
         // If there is at least one result it indicates this is a directory (at
         // least one object exists that starts with "path/")
         return FileInfo(path.full_path, FileType::Directory);
       }
       // Return the original not-found info if there was no match.
       return info;
     }
   ```
   
   The method above is used to retrieve file information in the 
FileSystem.get_file_info method:
   
[arrow.python.pyarrow._fs.pyx](https://github.com/apache/arrow/blob/main/python/pyarrow/_fs.pyx)


-- 
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: issues-unsubscr...@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


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

Reply via email to