From d3a0fcaa6baa71e93fe66f4cb11dd6aac5d4a625 Mon Sep 17 00:00:00 2001 From: Karan Singh Date: Wed, 26 Jan 2022 10:52:36 -0800 Subject: [PATCH 1/2] Duplicate bucket name will now cause the server to fail Signed-off-by: Karan Singh --- .../com/facebook/presto/s3/S3TableDescriptionSupplier.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/main/java/com/facebook/presto/s3/S3TableDescriptionSupplier.java b/src/main/java/com/facebook/presto/s3/S3TableDescriptionSupplier.java index 0a8d7ca..0f05af0 100644 --- a/src/main/java/com/facebook/presto/s3/S3TableDescriptionSupplier.java +++ b/src/main/java/com/facebook/presto/s3/S3TableDescriptionSupplier.java @@ -35,7 +35,9 @@ import java.io.File; import java.io.FileNotFoundException; +import java.util.Set; import java.util.function.Supplier; +import java.util.stream.Collectors; import static java.util.Objects.requireNonNull; import static com.facebook.presto.s3.S3Const.*; @@ -65,6 +67,10 @@ public Map get() { ImmutableMap.Builder builder = ImmutableMap.builder(); List listOfBuckets = this.accessObject.listBuckets(); + Set set = listOfBuckets.stream().map(Bucket::getName).map(String::toLowerCase).collect(Collectors.toSet()); + if(set.size() Date: Thu, 27 Jan 2022 07:44:40 -0800 Subject: [PATCH 2/2] Using a more detailed error message Signed-off-by: Karan Singh --- .../java/com/facebook/presto/s3/S3TableDescriptionSupplier.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/com/facebook/presto/s3/S3TableDescriptionSupplier.java b/src/main/java/com/facebook/presto/s3/S3TableDescriptionSupplier.java index 0f05af0..c595830 100644 --- a/src/main/java/com/facebook/presto/s3/S3TableDescriptionSupplier.java +++ b/src/main/java/com/facebook/presto/s3/S3TableDescriptionSupplier.java @@ -69,7 +69,7 @@ public Map get() { List listOfBuckets = this.accessObject.listBuckets(); Set set = listOfBuckets.stream().map(Bucket::getName).map(String::toLowerCase).collect(Collectors.toSet()); if(set.size()