You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Add location utilities for v4 relative paths #1123
Format v4 allows relative paths in metadata location fields, resolved against the table location (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.
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.
Activity
feat(util): add location resolve and relativize helpers