-
Notifications
You must be signed in to change notification settings - Fork 1.2k
[python] use str to replace pathlib.Path to avoid scheme missing in pypaimon #6604
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[python] use str to replace pathlib.Path to avoid scheme missing in pypaimon #6604
Conversation
|
Maybe we can just use str. |
5b4721f to
e87ada1
Compare
e87ada1 to
e4d22d6
Compare
| return self._trim_schema(self.warehouse) / f"{name}{Catalog.DB_SUFFIX}" | ||
| def get_database_path(self, name) -> str: | ||
| warehouse = self.warehouse.rstrip('/') | ||
| return f"{warehouse}/{name}{Catalog.DB_SUFFIX}" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
how about use os.path.join to construct the path? then you don’t need to use rstrip to remove trailing slashes from the warehouse path
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
how about use os.path.join to construct the path? then you don’t need to use rstrip to remove trailing slashes from the warehouse path
Thanks for your kind suggestion. I tried use os.path but found that
os.path.join(self.warehouse, "db.db")producesoss://bucket/path\db.dbon Windows instead ofoss://bucket/path/db.db. So I choose str concat finally
|
+1 |
2 similar comments
|
+1 |
|
+1 |
Purpose
Fixes URI scheme loss issue in blob-as-descriptor mode by replacing
pathlib.Pathwithstrthroughout the codebase. This ensures URI schemes (e.g.,oss://,s3://,file://) are preserved when handling blob descriptors and file paths.Key Changes
Replaced
pathlib.Pathwithstr: Unified path handling to preserve URI schemes across all filesystem operations.Impact
FileIO,FileSystemCatalog,RESTCatalog- all path operations usestrDataFileMeta,SchemaManager, manifest managers - - path storage usestrFormatBlobReader,DataWriter,BlobWriter, etc.) - consistentstrpath handlingFileStoreTable,SnapshotManager--table path usestrBlob,BlobDescriptor- URI scheme preservation for external blob storageTests
test_blob_write_read_end_to_end_with_descriptor: Verifies URI scheme preservation in blob descriptorsoss_blob_as_descriptor.py: Demonstrates OSS blob-as-descriptor functionality with scheme preservationtest_file_iorest_token_file_io