You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@iceberg.apache.org by GitBox <gi...@apache.org> on 2022/12/06 01:07:08 UTC

[GitHub] [iceberg] amogh-jahagirdar commented on a diff in pull request #6352: AWS: Fix inconsistent behavior of naming S3 location between read and write operations by allowing only s3 bucket name

amogh-jahagirdar commented on code in PR #6352:
URL: https://github.com/apache/iceberg/pull/6352#discussion_r1040279885


##########
aws/src/main/java/org/apache/iceberg/aws/s3/S3URI.java:
##########
@@ -74,17 +74,14 @@ class S3URI {
     this.scheme = schemeSplit[0];
 
     String[] authoritySplit = schemeSplit[1].split(PATH_DELIM, 2);
-    ValidationException.check(
-        authoritySplit.length == 2, "Invalid S3 URI, cannot determine bucket: %s", location);
-    ValidationException.check(
-        !authoritySplit[1].trim().isEmpty(), "Invalid S3 URI, path is empty: %s", location);
+

Review Comment:
   Never realized this class was package private. So that does give us the flexibility to change the behavior without impacting users. I think it makes sense then, AmazonS3URI in the AWS SDK has the same semantics for allowing bucket by itself as a URI. I do think we should confirm with @danielcweeks on if this was intentionally implemented this way in Iceberg. 



##########
aws/src/main/java/org/apache/iceberg/aws/s3/S3URI.java:
##########
@@ -74,17 +74,14 @@ class S3URI {
     this.scheme = schemeSplit[0];
 
     String[] authoritySplit = schemeSplit[1].split(PATH_DELIM, 2);
-    ValidationException.check(
-        authoritySplit.length == 2, "Invalid S3 URI, cannot determine bucket: %s", location);
-    ValidationException.check(
-        !authoritySplit[1].trim().isEmpty(), "Invalid S3 URI, path is empty: %s", location);
+
     this.bucket =
         bucketToAccessPointMapping == null
             ? authoritySplit[0]
             : bucketToAccessPointMapping.getOrDefault(authoritySplit[0], authoritySplit[0]);
 
     // Strip query and fragment if they exist
-    String path = authoritySplit[1];
+    String path = authoritySplit.length > 1 ? authoritySplit[1] : "";

Review Comment:
   Nit: If we go down this route, could we have key be an optional<string>?



-- 
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: issues-unsubscribe@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org