Stephen0421 commented on code in PR #10570: URL: https://github.com/apache/paimon/pull/10570#discussion_r4307306429
########## paimon-python/pypaimon/blob/managed_blob_payload.py: ########## @@ -0,0 +1,129 @@ +# 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. + +"""Resolve primary-key managed BLOB descriptors to payload bytes.""" + +from pypaimon.blob.managed_blob_reference_collector import _map_items +from pypaimon.schema.data_types import ( + is_array_blob_type, + is_blob_type, + is_map_blob_type, + managed_blob_field_names, +) +from pypaimon.table.row.blob import Blob, BlobDescriptor +from pypaimon.utils.path import resolve_path + + +def resolve_table_blob_uri(table_path, uri): + """Join a table-relative pack URI onto the table directory. + + Absolute paths and URIs that already carry a scheme are left unchanged so + descriptors written with a filesystem path still open. + """ + if uri is None or table_path is None: + return uri + normalized = uri.replace('\\', '/') + if (normalized.startswith('/') + or normalized.startswith('file:') + or '://' in normalized): + return uri + return resolve_path(str(table_path), normalized) Review Comment: Fixed in 556033789. A relative local warehouse path is now qualified with `os.path.abspath` before it is published in the descriptor and `.blobref`. Absolute paths, `file:` URIs, scheme URIs, and Windows drive paths are left unchanged, so `resolve_table_blob_uri` no longer prepends `table_path` a second time. Covered by `test_relative_warehouse_publishes_absolute_pack_uri`: warehouse `./wh`, write `(1, b'visible')`, then read. The payload comes back, and the descriptor URI is absolute, starts with the absolute warehouse path, contains `default.db` once, and the pack 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: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
