jbonofre commented on code in PR #9487:
URL: https://github.com/apache/iceberg/pull/9487#discussion_r1466247335


##########
core/src/main/java/org/apache/iceberg/jdbc/JdbcUtil.java:
##########
@@ -303,7 +319,152 @@ public static Properties 
filterAndRemovePrefix(Map<String, String> properties, S
     return result;
   }
 
-  public static String updatePropertiesStatement(int size) {
+  private static int update(
+      boolean isTable,
+      JdbcClientPool connections,
+      String catalogName,
+      TableIdentifier identifier,
+      String newMetadataLocation,
+      String oldMetadataLocation)
+      throws SQLException, InterruptedException {
+    return connections.run(
+        conn -> {
+          try (PreparedStatement sql = conn.prepareStatement(DO_COMMIT_SQL)) {
+            // UPDATE
+            sql.setString(1, newMetadataLocation);
+            sql.setString(2, oldMetadataLocation);
+            // WHERE
+            sql.setString(3, catalogName);
+            sql.setString(4, namespaceToString(identifier.namespace()));
+            sql.setString(5, identifier.name());
+            sql.setString(6, oldMetadataLocation);
+            sql.setString(7, isTable ? "TABLE" : "VIEW");
+            return sql.executeUpdate();
+          }
+        });
+  }
+
+  static int updateTable(
+      JdbcClientPool connections,
+      String catalogName,
+      TableIdentifier tableIdentifier,
+      String newMetadataLocation,
+      String oldMetadataLocation)
+      throws SQLException, InterruptedException {
+    return update(
+        true, connections, catalogName, tableIdentifier, newMetadataLocation, 
oldMetadataLocation);
+  }
+
+  static int updateView(
+      JdbcClientPool connections,
+      String catalogName,
+      TableIdentifier viewIdentifier,
+      String newMetadataLocation,
+      String oldMetadataLocation)
+      throws SQLException, InterruptedException {
+    return update(
+        false, connections, catalogName, viewIdentifier, newMetadataLocation, 
oldMetadataLocation);
+  }
+
+  static Map<String, String> get(

Review Comment:
   Ok no problem. Let me update 😉



-- 
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