rdblue commented on code in PR #18304:
URL: https://github.com/apache/iceberg/pull/18304#discussion_r4223278307
##########
core/src/main/java/org/apache/iceberg/LocationProviders.java:
##########
@@ -198,14 +197,29 @@ public String newDataLocation(String filename) {
}
private static String pathContext(String tableLocation) {
- Path dataPath = new Path(tableLocation);
- Path parent = dataPath.getParent();
+ // strip the scheme and authority (e.g. "s3://bucket") so only path
segments remain
+ String path = tableLocation;
+ int schemeEnd = path.indexOf("://");
+ if (schemeEnd >= 0) {
+ int authorityEnd = path.indexOf('/', schemeEnd + 3);
+ path = authorityEnd < 0 ? "" : path.substring(authorityEnd);
+ }
+
+ if (path.isEmpty()) {
+ return "";
Review Comment:
Returning an empty string is always a red flag for me. Is this preserving
existing behavior? If so, we need to justify why it is necessary to preserve it
(vs returning null and handling it). If it stays, we need a comment about why
we *cannot* change it.
--
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]