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

jshao pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/gravitino.git


The following commit(s) were added to refs/heads/main by this push:
     new 18668449e8 [#6940] fix(gvfs): fix python gvfs missing auto-create 
fileset dir (#7006)
18668449e8 is described below

commit 18668449e854f5e4b2228e3a6bd5ea2ea7a7aa0f
Author: mchades <[email protected]>
AuthorDate: Fri Apr 18 17:42:00 2025 +0800

    [#6940] fix(gvfs): fix python gvfs missing auto-create fileset dir (#7006)
    
    ### What changes were proposed in this pull request?
    
    fix python gvfs missing auto-create fileset dir
    
    ### Why are the changes needed?
    
    Fix: #6940
    
    ### Does this PR introduce _any_ user-facing change?
    
    no
    
    ### How was this patch tested?
    
    existing tests
---
 .../gravitino/filesystem/gvfs_base_operations.py   | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)

diff --git a/clients/client-python/gravitino/filesystem/gvfs_base_operations.py 
b/clients/client-python/gravitino/filesystem/gvfs_base_operations.py
index 62cc40934c..82280a87ac 100644
--- a/clients/client-python/gravitino/filesystem/gvfs_base_operations.py
+++ b/clients/client-python/gravitino/filesystem/gvfs_base_operations.py
@@ -378,8 +378,30 @@ class BaseGVFSOperations(ABC):
         actual_fs = self._get_filesystem(
             actual_location, catalog, fileset_ident, target_location_name
         )
+        self._create_fileset_location_if_needed(
+            catalog.properties(), actual_fs, actual_location
+        )
         return actual_fs
 
+    def _create_fileset_location_if_needed(
+        self,
+        catalog_props: Dict[str, str],
+        actual_fs: AbstractFileSystem,
+        fileset_path: str,
+    ):
+        # If the server-side filesystem ops are disabled, the fileset 
directory may not exist. In
+        # such case the operations like create, open, list files under this 
directory will fail.
+        # So we need to check the existence of the fileset directory 
beforehand.
+        fs_ops_disabled = catalog_props.get("disable-filesystem-ops", "false")
+        if fs_ops_disabled.lower() == "true":
+            if not actual_fs.exists(fileset_path):
+                actual_fs.makedir(fileset_path, create_parents=True)
+                logger.info(
+                    "Automatically created a directory for fileset path: %s 
when "
+                    "disable-filesystem-ops sets to true in the server side",
+                    fileset_path,
+                )
+
     def _get_actual_file_path(
         self, gvfs_path: str, location_name: str, operation: 
FilesetDataOperation
     ) -> str:

Reply via email to