rdblue commented on a change in pull request #1879:
URL: https://github.com/apache/iceberg/pull/1879#discussion_r536930541
##########
File path: core/src/main/java/org/apache/iceberg/CachingCatalog.java
##########
@@ -99,36 +99,35 @@ public Table loadTable(TableIdentifier ident) {
@Override
public Table createTable(TableIdentifier ident, Schema schema, PartitionSpec
spec, String location,
Map<String, String> properties) {
- AtomicBoolean created = new AtomicBoolean(false);
- Table table = tableCache.get(canonicalizeIdentifier(ident), identifier -> {
- created.set(true);
- return catalog.createTable(identifier, schema, spec, location,
properties);
- });
-
- if (!created.get()) {
- throw new AlreadyExistsException("Table already exists: %s", ident);
- }
-
- return table;
+ return buildTable(ident, schema)
+ .withPartitionSpec(spec)
+ .withLocation(location)
+ .withProperties(properties)
+ .create();
Review comment:
We should consider moving these to be default implementations in the
interface.
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]