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

roryqi pushed a commit to branch branch-0.9
in repository https://gitbox.apache.org/repos/asf/gravitino.git


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

commit b65eb1c4320c135463a050a0d817dc61cacc72dd
Author: github-actions[bot] 
<41898282+github-actions[bot]@users.noreply.github.com>
AuthorDate: Fri Apr 18 18:42:52 2025 +0800

    [#6940] fix(gvfs): fix python gvfs missing auto-create fileset dir (#7007)
    
    ### 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
    
    Co-authored-by: mchades <[email protected]>
---
 .../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