vigneshio commented on code in PR #4810:
URL: https://github.com/apache/polaris/pull/4810#discussion_r3459319548


##########
persistence/relational-jdbc/src/main/java/org/apache/polaris/persistence/relational/jdbc/DatasourceOperations.java:
##########
@@ -189,6 +189,42 @@ public <T> void executeSelectOverStream(
         });
   }
 
+  /** Connection-aware version for use inside runWithinTransaction. */
+  public <T> void executeSelectOverStream(
+      @NonNull Connection connection,
+      @NonNull PreparedQuery query,
+      @NonNull Converter<T> converterInstance,
+      @NonNull Consumer<Stream<T>> consumer)
+      throws SQLException {
+    withRetries(
+        () -> {
+          logQuery(query);
+          try (PreparedStatement statement = 
connection.prepareStatement(query.sql())) {
+            List<Object> params = query.parameters();
+            for (int i = 0; i < params.size(); i++) {
+              statement.setObject(i + 1, params.get(i));
+            }
+            try (ResultSet resultSet = statement.executeQuery()) {
+              ResultSetIterator<T> iterator = new 
ResultSetIterator<>(resultSet, converterInstance);
+              consumer.accept(iterator.toStream());
+              return null;
+            }

Review Comment:
   Done.. _Extracted the duplicated logic into a private helper method... Both 
the regular and connection-aware versions now delegate to it._



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