RussellSpitzer commented on code in PR #8194:
URL: https://github.com/apache/iceberg/pull/8194#discussion_r1282449588
##########
core/src/main/java/org/apache/iceberg/BaseMetastoreCatalog.java:
##########
@@ -192,6 +192,14 @@ public Table create() {
String baseLocation = location != null ? location :
defaultWarehouseLocation(identifier);
tableProperties.putAll(tableOverrideProperties());
+
+ if
(Boolean.parseBoolean(tableProperties.get(TableProperties.UNIQUE_LOCATION))) {
+ boolean alreadyExists = ops.io().newInputFile(baseLocation).exists();
+ if (alreadyExists) {
+ throw new AlreadyExistsException("Table location already in use:
%s", baseLocation);
Review Comment:
Not quite accurate since we are just checking whether the directory is
there, which is different than the location being in use. While I think this
may be good to check, we've seen most errors here being users setting table
locations as sub directories as other tables.
I think maybe we should check that the directory/location is empty? That's
probably a not too aggressive check?
--
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]