You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@polaris.apache.org by "flyingImer (via GitHub)" <gi...@apache.org> on 2026/07/16 20:01:59 UTC
[PR] Avoid fetching full entity rows in lookupEntityGrantRecordsVersion [polaris]
flyingImer opened a new pull request, #5078:
URL: https://github.com/apache/polaris/pull/5078
Follow up on https://github.com/apache/polaris/pull/5038 improvement, same patch idea
## Checklist
- [ ] ๐ก๏ธ Don't disclose security issues! (contact security@apache.org)
- [ ] ๐ Clearly explained why the changes are needed, or linked related issues: Fixes #
- [ ] ๐งช Added/updated tests with good coverage, or manually tested (and explained how)
- [ ] ๐ก Added comments for complex logic
- [ ] ๐งพ Updated `CHANGELOG.md` (if needed)
- [ ] ๐ Updated documentation in `site/content/in-dev/unreleased` (if needed)
--
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-unsubscribe@polaris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Avoid fetching full entity rows in lookupEntityGrantRecordsVersion [polaris]
Posted by "flyingImer (via GitHub)" <gi...@apache.org>.
flyingImer commented on PR #5078:
URL: https://github.com/apache/polaris/pull/5078#issuecomment-5063186107
@flyrain can you please help with the merge?
--
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-unsubscribe@polaris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Avoid fetching full entity rows in lookupEntityGrantRecordsVersion [polaris]
Posted by "ayushtkn (via GitHub)" <gi...@apache.org>.
ayushtkn commented on code in PR #5078:
URL: https://github.com/apache/polaris/pull/5078#discussion_r3598576126
##########
persistence/relational-jdbc/src/main/java/org/apache/polaris/persistence/relational/jdbc/JdbcBasePersistenceImpl.java:
##########
@@ -627,14 +627,26 @@ public <T> Page<T> listFullEntities(
@Override
public int lookupEntityGrantRecordsVersion(
@NonNull PolarisCallContext callCtx, long catalogId, long entityId) {
-
Map<String, Object> params =
Map.of("catalog_id", catalogId, "id", entityId, "realm_id", realmId);
- PolarisBaseEntity b =
- getPolarisBaseEntity(
- QueryGenerator.generateSelectQuery(
- ModelEntity.getAllColumnNames(schemaVersion), ModelEntity.TABLE_NAME, params));
- return b == null ? 0 : b.getGrantRecordsVersion();
+ PreparedQuery query =
+ QueryGenerator.generateSelectQuery(
+ ModelEntity.VERSION_COLUMNS, ModelEntity.TABLE_NAME, params);
+ try {
+ var results = datasourceOperations.executeSelect(query, new EntityVersionConverter());
+ if (results.isEmpty()) {
+ return 0;
+ } else if (results.size() > 1) {
+ throw new IllegalStateException(
+ String.format(
+ "More than one(%s) entities were found for catalogId=%s, entityId=%s",
+ results.size(), catalogId, entityId));
+ }
+ return results.getFirst().versions().grantRecordsVersion();
+ } catch (SQLException e) {
+ throw new RuntimeException(
+ String.format("Failed to retrieve grant records version due to %s", e.getMessage()), e);
+ }
}
Review Comment:
Does this works?
```
public int lookupEntityGrantRecordsVersion(
@NonNull PolarisCallContext callCtx, long catalogId, long entityId) {
List<PolarisChangeTrackingVersions> versions =
lookupEntityVersions(callCtx, List.of(new PolarisEntityId(catalogId, entityId)));
PolarisChangeTrackingVersions version = versions.getFirst();
return version == null ? 0 : version.grantRecordsVersion();
}
```
##########
persistence/relational-jdbc/src/test/java/org/apache/polaris/persistence/relational/jdbc/JdbcBasePersistenceImplTest.java:
##########
@@ -217,6 +217,76 @@ void lookupEntityVersionsPreservesOrderAndNullsForMissing(int schemaVersion)
assertThat(captor.getValue().sql()).doesNotContain("properties");
}
+ @ParameterizedTest
+ @ValueSource(ints = {1, 2})
+ void lookupEntityGrantRecordsVersionReturnsVersionOrZeroForMissing(int schemaVersion)
Review Comment:
the test seems to be almost same as `lookupEntityVersionsPreservesOrderAndNullsForMissing` , can we refactor to avoid duplication?
--
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-unsubscribe@polaris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Avoid fetching full entity rows in lookupEntityGrantRecordsVersion [polaris]
Posted by "flyingImer (via GitHub)" <gi...@apache.org>.
flyingImer commented on PR #5078:
URL: https://github.com/apache/polaris/pull/5078#issuecomment-5028904916
resolved conflicts @flyrain @ayushtkn pls take another look, ty!
--
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-unsubscribe@polaris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Avoid fetching full entity rows in lookupEntityGrantRecordsVersion [polaris]
Posted by "flyrain (via GitHub)" <gi...@apache.org>.
flyrain merged PR #5078:
URL: https://github.com/apache/polaris/pull/5078
--
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-unsubscribe@polaris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org