Baunsgaard commented on PR #15173:
URL: https://github.com/apache/iceberg/pull/15173#issuecomment-3823827085
Thanks for the review feedback @szehon-ho and @dramaticlly!
I have updated the implementation, though with a slight variation from the
suggested approach.
### What was suggested
```python
if (!path.startsWith(toRemove) && !path.equals(prefix)) {
throw ...
}
```
### What I implemented
```python
if (!path.startsWith(toRemove) &&
!maybeAppendFileSeparator(path).equals(toRemove)) {
throw ...
}
```
### Why the difference
The suggested approach using `!path.equals(prefix)` was stricter - it would
reject `relativize("/a", "/a/")` because `"/a" != "/a/"`.
I chose to normalize both sides because:
- `/a` and `/a/` represent the same directory
- Table properties may come from different sources with inconsistent
trailing separators
- Being strict about this mismatch seemed overly pedantic for a utility
method
This means all trailing separator combinations now work:
--
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]