dimas-b commented on code in PR #1496:
URL: https://github.com/apache/polaris/pull/1496#discussion_r2067592409
##########
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:
Unrelated to the transaction discussions, this code pattern does not look
nice from the object-oriented design POV. Would it be possible to avoid if/else
with `instanceof` if you still want to achieve different call paths for these
cases?
--
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]