vttranlina commented on code in PR #2048:
URL: https://github.com/apache/james-project/pull/2048#discussion_r1502032559


##########
mailbox/postgres/src/main/java/org/apache/james/mailbox/postgres/mail/dao/PostgresAttachmentDAO.java:
##########
@@ -80,9 +84,21 @@ public Mono<Pair<AttachmentMetadata, BlobId>> 
getAttachment(AttachmentId attachm
                 blobIdFactory.from(row.get(PostgresAttachmentTable.BLOB_ID))));
     }
 
+    public Flux<AttachmentMetadata> getAttachments(Collection<AttachmentId> 
attachmentIds) {
+        return postgresExecutor.executeRows(dslContext -> 
Flux.from(dslContext.selectFrom(PostgresAttachmentTable.TABLE_NAME)
+                
.where(PostgresAttachmentTable.ID_AS_UUID.in(attachmentIds.stream().map(AttachmentId::asUUID).collect(ImmutableList.toImmutableList())))))

Review Comment:
   1. Why do we don't use directly "AttachmentId.getId()" in `where` clause?
   2. When using "IN" clause, we should check the size of IN, if large, we 
should partition it, see the same 
`PostgresMailboxMessageDAO#findMessagesByMailboxIdAndUIDs`



-- 
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: notifications-unsubscr...@james.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscr...@james.apache.org
For additional commands, e-mail: notifications-h...@james.apache.org

Reply via email to