xndai opened a new issue, #1123: URL: https://github.com/apache/iceberg-cpp/issues/1123
Format v4 allows relative paths in metadata location fields, resolved against the table location ([Paths in Metadata](https://iceberg.apache.org/spec/#paths-in-metadata), apache/iceberg#15630). iceberg-cpp has `LocationUtil::ParseScheme` but nothing to tell absolute paths from relative ones, resolve relative paths, or relativize paths when writing. The v4 metadata, manifest and catalog work needs these first. Proposal: add three helpers to `LocationUtil`, following Java's `LocationUtil` (apache/iceberg#16174, apache/iceberg#17807): - `HasScheme(location)`: strict RFC 3986 scheme detection, which is the spec's test for an absolute path. - `ResolveLocation(table_location, path)`: absolute paths are returned unchanged; relative paths are joined to the table location with `/`. There is no `.`/`..` normalization and no URI parsing, so encoded characters are kept as they are. - `RelativizeLocation(table_location, path)`: returns the part after `<table location>/` if the path is under the table location, otherwise the path unchanged. One difference from Java: if the table location ends in `/`, no second separator is added. The spec already recommends that a table location not end in `/`, and S3 treats `//` as part of the object key. Out of scope: using the helpers in metadata, manifests or catalogs, and adding a scheme to scheme-less paths in pre-v4 tables. Both are follow-ups. Tests cover every example in the spec's path resolution table, plus edge cases: trailing slashes, sibling prefixes such as `/t` vs `/t2`, different schemes, escaped characters, and relativize-then-resolve round trips. Part of #1107. -- 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] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
