nastra commented on code in PR #9770:
URL: https://github.com/apache/iceberg/pull/9770#discussion_r1497818067


##########
core/src/main/java/org/apache/iceberg/jdbc/JdbcCatalog.java:
##########
@@ -812,4 +815,32 @@ private boolean deleteProperties(Namespace namespace, 
Set<String> properties) {
   protected Map<String, String> properties() {
     return catalogProperties == null ? ImmutableMap.of() : catalogProperties;
   }
+
+  @Override
+  public TableBuilder buildTable(TableIdentifier identifier, Schema schema) {
+    return new ViewAwareTableBuilder(identifier, schema);
+  }
+
+  /**
+   * The purpose of this class is to add view detection only when 
SchemaVersion.V1 schema is used
+   * when replacing a table.
+   */
+  protected class ViewAwareTableBuilder extends 
BaseMetastoreCatalogTableBuilder {
+
+    private final TableIdentifier identifier;
+
+    public ViewAwareTableBuilder(TableIdentifier identifier, Schema schema) {
+      super(identifier, schema);
+      this.identifier = identifier;
+    }
+
+    @Override
+    public Transaction replaceTransaction() {
+      if (schemaVersion == JdbcUtil.SchemaVersion.V1 && 
viewExists(identifier)) {

Review Comment:
   that's what's already happening and this breaks existing functionality (when 
a table is renamed) when using the catalog with v0. So we actually need to skip 
checking for views when the schema is v0



-- 
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-unsubscr...@iceberg.apache.org

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


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

Reply via email to