dimas-b commented on code in PR #1938: URL: https://github.com/apache/polaris/pull/1938#discussion_r2168025609
########## polaris-core/src/main/java/org/apache/polaris/core/persistence/transactional/TreeMapTransactionalPersistenceImpl.java: ########## @@ -361,13 +362,23 @@ public List<EntityNameLookupRecord> lookupEntityActiveBatchInCurrentTxn( .map( nameRecord -> this.lookupEntityInCurrentTxn( - callCtx, catalogId, nameRecord.getId(), entityType.getCode())) - .filter(entityFilter); - if (pageToken instanceof HasPageSize) { - data = data.limit(((HasPageSize) pageToken).getPageSize()); - } + callCtx, catalogId, nameRecord.getId(), entityType.getCode())); + + Predicate<PolarisBaseEntity> tokenFilter = + pageToken + .valueAs(EntityIdToken.class) + .map( + entityIdToken -> { + var nextId = entityIdToken.entityId(); + return (Predicate<PolarisBaseEntity>) e -> e.getId() > nextId; + }) + .orElse(e -> true); + + data = data.sorted(Comparator.comparingLong(PolarisEntityCore::getId)).filter(tokenFilter); + + data = data.filter(entityFilter); Review Comment: (I think it came from my PR) No particular reason. Would you prefer a chained call? -- 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