eric-maynard commented on code in PR #1487:
URL: https://github.com/apache/polaris/pull/1487#discussion_r2067144887


##########
extension/persistence/relational-jdbc/src/main/java/org/apache/polaris/extension/persistence/relational/jdbc/JdbcBasePersistenceImpl.java:
##########
@@ -417,9 +415,17 @@ public <T> List<T> listEntities(
     // absence of transaction.
     String query = QueryGenerator.generateSelectQuery(ModelEntity.class, 
params);
     try {
-      List<PolarisBaseEntity> results =
-          datasourceOperations.executeSelect(
-              query, ModelEntity.class, ModelEntity::toEntity, entityFilter, 
limit);
+      List<PolarisBaseEntity> results = new ArrayList<>();
+      datasourceOperations.executeSelectOverStream(
+          query,
+          new ModelEntity(),
+          stream -> {
+            stream
+                .map(ModelEntity::toEntity)
+                .filter(entityFilter)
+                .limit(limit)
+                .forEach(results::add);

Review Comment:
   With the loan pattern, we aren't returning anything so we need to get the 
list as a side effect. Unfortunately, there is a restriction in Java that 
variables pulled in to the scope of a lambda must be "effectively final", so we 
can't do like `results = ...toList()` in the lambda



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

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

Reply via email to