singhpk234 commented on code in PR #1496:
URL: https://github.com/apache/polaris/pull/1496#discussion_r2067651243


##########
extension/persistence/relational-jdbc/src/main/java/org/apache/polaris/extension/persistence/relational/jdbc/JdbcBasePersistenceImpl.java:
##########
@@ -189,6 +185,17 @@ private void persistEntity(
     }
   }
 
+  private int execute(Object executor, String query) throws SQLException {
+    if (executor instanceof Statement) {
+      // used for running in transaction
+      return ((Statement) executor).executeUpdate(query);
+    } else if (executor instanceof DatasourceOperations) {
+      return ((DatasourceOperations) executor).executeUpdate(query);
+    } else {
+      throw new IllegalArgumentException("Unsupported executor: " + executor);
+    }
+  }

Review Comment:
   i see, i tried the following :  try out passing a Consumer and sneakyThrow 
but it does introduce another set of if-elses so settled on this for now. Open 
to other suggestions. OOP is not possible honestly as these are not our managed 
object to define an intereface on and then calling interface function, but i 
think it was too much for the goal to achieve. Please let me know if you 
strongly feel about this, i can introduce that introduce interface as well



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

Reply via email to