You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@gravitino.apache.org by "mariamjafri (via GitHub)" <gi...@apache.org> on 2026/06/25 08:05:04 UTC

[PR] [#5869] test(client-python): add special character and encoding tests [gravitino]

mariamjafri opened a new pull request, #11797:
URL: https://github.com/apache/gravitino/pull/11797

   ### What changes were proposed in this pull request?
   
   Added a new unit-test file: `tests/unittests/test_gvfs_filename_encoding.py` which tests file-name encodings that contain special characters in the GVFS path-conversion layer. Particularly testing the following functions: 
   `actual_path_to_gvfs_path`, `actual_info_to_gvfs_info`, and the round-trip through `extract_identifier` / `get_sub_path_from_virtual_path` / `to_gvfs_path_prefix`.
   
   Tests include spaces and URL-significant ASCII (`#`, `%`, `&`, `?`, `+`, `=`, `@`, `!`), multi-byte Unicode (CJK, accented Latin, Cyrillic, RTL), emoji, and path-structure characters (encoded slash `%2F`, leading/trailing dots, very long names) placed in filenames, nested directories, fileset-name segments, and sub-paths.
   
   The tests confirm all of these convert and round-trip correctly. One issue found is documented via `@unittest.expectedFailure`: the all-occurrences `str.replace` in `actual_path_to_gvfs_path` corrupts paths when the
   storage prefix recurs as a later directory segment. 
   
   ### Why are the changes needed?
   
   Fix: #5869
   
   Per the above issue, GVFS special-character / encoding behavior was untested and its correctness
   was uncertain. These tests verify and document it.
   
   ### Does this PR introduce _any_ user-facing change?
   
   No. 
   
   ### How was this patch tested?
   
   `pytest tests/unittests/test_gvfs_filename_encoding.py -v` → 5 passed, 1 xfailed
   100 subtests passed. 
   `ruff check` and `ruff format --check` pass clean.
   


-- 
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: commits-unsubscribe@gravitino.apache.org

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


Re: [PR] [#5869] test(client-python): add special character and encoding tests [gravitino]

Posted by "Copilot (via GitHub)" <gi...@apache.org>.
Copilot commented on code in PR #11797:
URL: https://github.com/apache/gravitino/pull/11797#discussion_r3503129221


##########
clients/client-python/tests/unittests/test_gvfs_filename_encoding.py:
##########
@@ -0,0 +1,188 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+"""Tests for file name encoding and special-character handling in GVFS.
+
+See https://github.com/apache/gravitino/issues/5869. These tests verify that
+the GVFS path-conversion layer round-trips file names containing spaces,
+URL-significant ASCII characters, multi-byte Unicode (CJK / accents / Cyrillic),
+emoji, and path-structure characters without garbling them.
+
+The conversion functions exercised here are effectively pure given their string
+arguments, so the local storage handler (``LOCA_HANDLER``) and the
+``gvfs_utils`` helpers are called directly without mocking a Gravitino server.
+
+Finding: because Python 3 ``str`` is Unicode, every special-character category
+below converts and round-trips correctly. The single confirmed defect is the
+all-occurrences ``str.replace`` in ``actual_path_to_gvfs_path`` (documented via
+``unittest.expectedFailure`` below); fixing it is left to a follow-up under the
+parent epic #5504.
+"""
+
+import unittest
+
+from gravitino import NameIdentifier
+from gravitino.filesystem.gvfs_storage_handler import LOCA_HANDLER
+from gravitino.filesystem.gvfs_utils import (
+    extract_identifier,
+    get_sub_path_from_virtual_path,
+    to_gvfs_path_prefix,
+)
+
+# pylint: disable=protected-access

Review Comment:
   `# pylint: disable=protected-access` appears unnecessary in this test file (no protected/private members are accessed). Keeping it can trigger pylint's “useless suppression” noise and makes it harder to understand why the disable exists.



-- 
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: commits-unsubscribe@gravitino.apache.org

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


Re: [PR] [#5869] test(client-python): add special character and encoding tests [gravitino]

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #11797:
URL: https://github.com/apache/gravitino/pull/11797#issuecomment-4811081384

   <!-- coverage-report -->
   ### Code Coverage Report
   |Overall Project|67.22%|:green_circle:|
   |:-|:-|:-:|
   |Files changed|71.01%|:green_circle:|
   <br>
   
   |Module|Coverage||
   |:-|:-|:-:|
   |aliyun|1.72%|:red_circle:|
   |api|46.82%|:green_circle:|
   |authorization-common|85.96%|:green_circle:|
   |aws|26.5%|:red_circle:|
   |azure|2.47%|:red_circle:|
   |catalog-common|10.4%|:red_circle:|
   |catalog-fileset|80.23%|:green_circle:|
   |catalog-glue|66.91%|:green_circle:|
   |catalog-hive|79.42%|:green_circle:|
   |catalog-jdbc-clickhouse|80.02%|:green_circle:|
   |catalog-jdbc-common|44.22%|:green_circle:|
   |catalog-jdbc-doris|80.28%|:green_circle:|
   |catalog-jdbc-hologres|54.03%|:green_circle:|
   |catalog-jdbc-mysql|79.23%|:green_circle:|
   |catalog-jdbc-oceanbase|80.91%|:green_circle:|
   |catalog-jdbc-postgresql|82.29%|:green_circle:|
   |catalog-jdbc-starrocks|78.51%|:green_circle:|
   |catalog-kafka|77.01%|:green_circle:|
   |catalog-lakehouse-generic|58.53%|:green_circle:|
   |catalog-lakehouse-hudi|79.1%|:green_circle:|
   |catalog-lakehouse-iceberg|85.86%|:green_circle:|
   |catalog-lakehouse-paimon|82.14%|:green_circle:|
   |catalog-model|77.72%|:green_circle:|
   |cli|44.51%|:green_circle:|
   |client-java|78.01%|:green_circle:|
   |common|50.17%|:green_circle:|
   |core|82.58%|:green_circle:|
   |filesystem-hadoop3|77.27%|:green_circle:|
   |flink|0.0%|:red_circle:|
   |flink-common|47.12%|:green_circle:|
   |flink-runtime|0.0%|:red_circle:|
   |gcp|14.12%|:red_circle:|
   |hadoop-common|10.88%|:red_circle:|
   |hive-metastore-common|53.77%|:green_circle:|
   |iceberg-common|58.15%|:green_circle:|
   |iceberg-rest-server|73.9%|:green_circle:|
   |idp-basic|85.71%|:green_circle:|
   |integration-test-common|0.0%|:red_circle:|
   |jobs|66.17%|:green_circle:|
   |lance-common|20.83%|:red_circle:|
   |lance-rest-server|60.13%|:green_circle:|
   |lineage|53.02%|:green_circle:|
   |optimizer|82.87%|:green_circle:|
   |optimizer-api|21.95%|:red_circle:|
   |server|85.96%|:green_circle:|
   |server-common|74.18%|:green_circle:|
   |spark|28.57%|:red_circle:|
   |spark-common|41.66%|:green_circle:|
   |trino-connector|40.25% **`+0.57%`**|:green_circle:|
   
   <details>
   <summary>Files</summary>
   
   |Module|File|Coverage||
   |:-|:-|:-|:-:|
   |trino-connector|[IcebergCatalogPropertyConverter.java](https://github.com/mariamjafri/gravitino/blob/2b220dcd8ebf0ca663cfac9c94397024ebb756f0/trino-connector/trino-connector/src/main/java/org/apache/gravitino/trino/connector/catalog/iceberg/IcebergCatalogPropertyConverter.java)|71.01%|:green_circle:|
   
   </details>


-- 
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: commits-unsubscribe@gravitino.apache.org

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


Re: [PR] [#5869] test(client-python): add special character and encoding tests [gravitino]

Posted by "diqiu50 (via GitHub)" <gi...@apache.org>.
diqiu50 commented on PR #11797:
URL: https://github.com/apache/gravitino/pull/11797#issuecomment-4899565300

   @mariamjafri Thanks for your contribution.
   The goal of this issue is to investigate and resolve filename encoding issues in GVFS FUSE, rather than address issues in the GVFS Python client.


-- 
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: commits-unsubscribe@gravitino.apache.org

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


Re: [PR] [#5869] test(client-python): add special character and encoding tests [gravitino]

Posted by "yuqi1129 (via GitHub)" <gi...@apache.org>.
yuqi1129 commented on PR #11797:
URL: https://github.com/apache/gravitino/pull/11797#issuecomment-4810477877

   @mariamjafri 
   Please help to review this one. 


-- 
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: commits-unsubscribe@gravitino.apache.org

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