You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@polaris.apache.org by "dimas-b (via GitHub)" <gi...@apache.org> on 2025/03/14 01:04:49 UTC
[PR] Simplify PolarisGrantManager [polaris]
dimas-b opened a new pull request, #1171:
URL: https://github.com/apache/polaris/pull/1171
Previously strongly typed methods redirected to typeless lookup methods, while implementations had only the typeless variant.
This change reverts the redirects from strongly typed methods to existing typeless methods in implementations.
As a result it is possible to simplify the interface by removing typeless lookup methods.
Existing call sites all have strongly typed parameters available and use the typed lookup methods now.
For context: This refactoring seems valuable by itself, but it is also needed for the upcoming NoSQL implementations for reasons similar to #1112
<!--
Possible security vulnerabilities: STOP here and contact security@apache.org instead!
Please update the title of the PR with a meaningful message - do not leave it "empty" or "generated"
Please update this summary field:
The summary should cover these topics, if applicable:
* the motivation for the change
* a description of the status quo, for example the current behavior
* the desired behavior
* etc
PR checklist:
- Do a self-review of your code before opening a pull request
- Make sure that there's good test coverage for the changes included in this PR
- Run tests locally before pushing a PR (./gradlew check)
- Code should have comments where applicable. Particularly hard-to-understand
areas deserve good in-line documentation.
- Include changes and enhancements to the documentation (in site/content/in-dev/unreleased)
- For Work In Progress Pull Requests, please use the Draft PR feature.
Make sure to add the information BELOW this comment.
Everything in this comment will NOT be added to the PR description.
-->
--
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] Simplify PolarisGrantManager [polaris]
Posted by "dimas-b (via GitHub)" <gi...@apache.org>.
dimas-b commented on code in PR #1171:
URL: https://github.com/apache/polaris/pull/1171#discussion_r1996269593
##########
polaris-core/src/main/java/org/apache/polaris/core/persistence/transactional/PolarisMetaStoreManagerImpl.java:
##########
@@ -1807,6 +1812,11 @@ private PolarisEntityResolver resolveSecurableToRoleGrant(
/** {@inheritDoc} */
@Override
+ public @Nonnull LoadGrantsResult loadGrantsToGrantee(
+ @Nonnull PolarisCallContext callCtx, PolarisEntityCore grantee) {
+ return loadGrantsToGrantee(callCtx, grantee.getCatalogId(), grantee.getId());
+ }
+
public @Nonnull LoadGrantsResult loadGrantsToGrantee(
Review Comment:
No, but I did not want to expand the scope of changes unnecessarily.
--
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] Simplify PolarisGrantManager [polaris]
Posted by "dimas-b (via GitHub)" <gi...@apache.org>.
dimas-b commented on code in PR #1171:
URL: https://github.com/apache/polaris/pull/1171#discussion_r1996217903
##########
polaris-core/src/main/java/org/apache/polaris/core/persistence/AtomicOperationMetaStoreManager.java:
##########
@@ -1328,8 +1328,12 @@ private void revokeGrantRecord(
return new PrivilegeResult(grantRecord);
}
- /** {@inheritDoc} */
Review Comment:
restored
##########
polaris-core/src/main/java/org/apache/polaris/core/persistence/AtomicOperationMetaStoreManager.java:
##########
@@ -1369,8 +1373,12 @@ private void revokeGrantRecord(
entities.stream().filter(Objects::nonNull).collect(Collectors.toList()));
}
- /** {@inheritDoc} */
Review Comment:
restored
--
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] Simplify PolarisGrantManager [polaris]
Posted by "dimas-b (via GitHub)" <gi...@apache.org>.
dimas-b commented on PR #1171:
URL: https://github.com/apache/polaris/pull/1171#issuecomment-2726063992
@eric-maynard : I merged this, but will be happy to address your comments in follow-up PRs, if you have any :)
--
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] Simplify PolarisGrantManager [polaris]
Posted by "adutra (via GitHub)" <gi...@apache.org>.
adutra commented on code in PR #1171:
URL: https://github.com/apache/polaris/pull/1171#discussion_r1995158152
##########
polaris-core/src/main/java/org/apache/polaris/core/persistence/TransactionWorkspaceMetaStoreManager.java:
##########
@@ -50,6 +50,7 @@
import org.apache.polaris.core.persistence.dao.entity.ScopedCredentialsResult;
import org.apache.polaris.core.persistence.dao.entity.ValidateAccessResult;
import org.apache.polaris.core.storage.PolarisStorageActions;
+import org.jetbrains.annotations.NotNull;
Review Comment:
Should we use Jakarta instead?
##########
polaris-core/src/main/java/org/apache/polaris/core/persistence/transactional/PolarisMetaStoreManagerImpl.java:
##########
@@ -66,6 +66,7 @@
import org.apache.polaris.core.storage.PolarisStorageActions;
import org.apache.polaris.core.storage.PolarisStorageConfigurationInfo;
import org.apache.polaris.core.storage.PolarisStorageIntegration;
+import org.jetbrains.annotations.NotNull;
Review Comment:
Same. I wonder why JetBrains is even present in the classpath? 🤔
--
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] Simplify PolarisGrantManager [polaris]
Posted by "dimas-b (via GitHub)" <gi...@apache.org>.
dimas-b commented on code in PR #1171:
URL: https://github.com/apache/polaris/pull/1171#discussion_r1996218511
##########
polaris-core/src/main/java/org/apache/polaris/core/auth/PolarisGrantManager.java:
##########
@@ -119,23 +118,8 @@ PrivilegeResult revokePrivilegeOnSecurableFromRole(
* ENTITY_NOT_FOUND if the securable cannot be found
*/
@Nonnull
- default LoadGrantsResult loadGrantsOnSecurable(
- @Nonnull PolarisCallContext callCtx, PolarisBaseEntity securable) {
- return loadGrantsOnSecurable(callCtx, securable.getCatalogId(), securable.getId());
- }
-
- /**
- * This method should be used by the Polaris app to cache all grant records on a securable.
- *
- * @param callCtx call context
- * @param securableCatalogId id of the catalog this securable belongs to
- * @param securableId id of the securable
- * @return the list of grants and the version of the grant records. We will return
- * ENTITY_NOT_FOUND if the securable cannot be found
- */
Review Comment:
The whole method that hosted this javadoc was removed from the interface
--
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] Simplify PolarisGrantManager [polaris]
Posted by "dimas-b (via GitHub)" <gi...@apache.org>.
dimas-b commented on PR #1171:
URL: https://github.com/apache/polaris/pull/1171#issuecomment-2725656906
@eric-maynard : javadoc was not lost in the interface... it's just that GH formats this diff in a peculiar way :) Please have another look.
--
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] Simplify PolarisGrantManager [polaris]
Posted by "dimas-b (via GitHub)" <gi...@apache.org>.
dimas-b commented on code in PR #1171:
URL: https://github.com/apache/polaris/pull/1171#discussion_r1995477514
##########
polaris-core/src/main/java/org/apache/polaris/core/persistence/TransactionWorkspaceMetaStoreManager.java:
##########
@@ -50,6 +50,7 @@
import org.apache.polaris.core.persistence.dao.entity.ScopedCredentialsResult;
import org.apache.polaris.core.persistence.dao.entity.ValidateAccessResult;
import org.apache.polaris.core.storage.PolarisStorageActions;
+import org.jetbrains.annotations.NotNull;
Review Comment:
fixed
--
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] Simplify PolarisGrantManager [polaris]
Posted by "eric-maynard (via GitHub)" <gi...@apache.org>.
eric-maynard commented on code in PR #1171:
URL: https://github.com/apache/polaris/pull/1171#discussion_r1996045373
##########
polaris-core/src/main/java/org/apache/polaris/core/auth/PolarisGrantManager.java:
##########
@@ -119,23 +118,8 @@ PrivilegeResult revokePrivilegeOnSecurableFromRole(
* ENTITY_NOT_FOUND if the securable cannot be found
*/
@Nonnull
- default LoadGrantsResult loadGrantsOnSecurable(
- @Nonnull PolarisCallContext callCtx, PolarisBaseEntity securable) {
- return loadGrantsOnSecurable(callCtx, securable.getCatalogId(), securable.getId());
- }
-
- /**
- * This method should be used by the Polaris app to cache all grant records on a securable.
- *
- * @param callCtx call context
- * @param securableCatalogId id of the catalog this securable belongs to
- * @param securableId id of the securable
- * @return the list of grants and the version of the grant records. We will return
- * ENTITY_NOT_FOUND if the securable cannot be found
- */
Review Comment:
Oh I see, the doc itself was removed. Can we re-introduce a javadoc?
--
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] Simplify PolarisGrantManager [polaris]
Posted by "HonahX (via GitHub)" <gi...@apache.org>.
HonahX commented on code in PR #1171:
URL: https://github.com/apache/polaris/pull/1171#discussion_r1996245942
##########
polaris-core/src/main/java/org/apache/polaris/core/persistence/transactional/PolarisMetaStoreManagerImpl.java:
##########
@@ -1807,6 +1812,11 @@ private PolarisEntityResolver resolveSecurableToRoleGrant(
/** {@inheritDoc} */
@Override
+ public @Nonnull LoadGrantsResult loadGrantsToGrantee(
+ @Nonnull PolarisCallContext callCtx, PolarisEntityCore grantee) {
+ return loadGrantsToGrantee(callCtx, grantee.getCatalogId(), grantee.getId());
+ }
+
public @Nonnull LoadGrantsResult loadGrantsToGrantee(
Review Comment:
[question] Does this still need to be public?
--
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] Simplify PolarisGrantManager [polaris]
Posted by "dimas-b (via GitHub)" <gi...@apache.org>.
dimas-b merged PR #1171:
URL: https://github.com/apache/polaris/pull/1171
--
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] Simplify PolarisGrantManager [polaris]
Posted by "eric-maynard (via GitHub)" <gi...@apache.org>.
eric-maynard commented on code in PR #1171:
URL: https://github.com/apache/polaris/pull/1171#discussion_r1996044252
##########
polaris-core/src/main/java/org/apache/polaris/core/persistence/AtomicOperationMetaStoreManager.java:
##########
@@ -1328,8 +1328,12 @@ private void revokeGrantRecord(
return new PrivilegeResult(grantRecord);
}
- /** {@inheritDoc} */
Review Comment:
Shall we copy over the doc?
##########
polaris-core/src/main/java/org/apache/polaris/core/persistence/AtomicOperationMetaStoreManager.java:
##########
@@ -1369,8 +1373,12 @@ private void revokeGrantRecord(
entities.stream().filter(Objects::nonNull).collect(Collectors.toList()));
}
- /** {@inheritDoc} */
Review Comment:
ditto
--
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] Simplify PolarisGrantManager [polaris]
Posted by "dimas-b (via GitHub)" <gi...@apache.org>.
dimas-b commented on code in PR #1171:
URL: https://github.com/apache/polaris/pull/1171#discussion_r1995461038
##########
polaris-core/src/main/java/org/apache/polaris/core/persistence/transactional/PolarisMetaStoreManagerImpl.java:
##########
@@ -66,6 +66,7 @@
import org.apache.polaris.core.storage.PolarisStorageActions;
import org.apache.polaris.core.storage.PolarisStorageConfigurationInfo;
import org.apache.polaris.core.storage.PolarisStorageIntegration;
+import org.jetbrains.annotations.NotNull;
Review Comment:
Will fix this PR locally and look into JetBrains jars separately :+1:
--
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] Simplify PolarisGrantManager [polaris]
Posted by "snazy (via GitHub)" <gi...@apache.org>.
snazy commented on code in PR #1171:
URL: https://github.com/apache/polaris/pull/1171#discussion_r1995269679
##########
polaris-core/src/main/java/org/apache/polaris/core/persistence/TransactionWorkspaceMetaStoreManager.java:
##########
@@ -50,6 +50,7 @@
import org.apache.polaris.core.persistence.dao.entity.ScopedCredentialsResult;
import org.apache.polaris.core.persistence.dao.entity.ValidateAccessResult;
import org.apache.polaris.core.storage.PolarisStorageActions;
+import org.jetbrains.annotations.NotNull;
Review Comment:
Yea, let's use the Jakarta annotations
--
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] Simplify PolarisGrantManager [polaris]
Posted by "dimas-b (via GitHub)" <gi...@apache.org>.
dimas-b commented on code in PR #1171:
URL: https://github.com/apache/polaris/pull/1171#discussion_r1995464397
##########
polaris-core/src/main/java/org/apache/polaris/core/persistence/transactional/PolarisMetaStoreManagerImpl.java:
##########
@@ -66,6 +66,7 @@
import org.apache.polaris.core.storage.PolarisStorageActions;
import org.apache.polaris.core.storage.PolarisStorageConfigurationInfo;
import org.apache.polaris.core.storage.PolarisStorageIntegration;
+import org.jetbrains.annotations.NotNull;
Review Comment:
Looks like IJ tricks - I override a method with jakarta annotations, but the override gets JetBrains annotations :joy:
--
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] Simplify PolarisGrantManager [polaris]
Posted by "dimas-b (via GitHub)" <gi...@apache.org>.
dimas-b commented on code in PR #1171:
URL: https://github.com/apache/polaris/pull/1171#discussion_r1995552025
##########
polaris-core/src/main/java/org/apache/polaris/core/persistence/transactional/PolarisMetaStoreManagerImpl.java:
##########
@@ -66,6 +66,7 @@
import org.apache.polaris.core.storage.PolarisStorageActions;
import org.apache.polaris.core.storage.PolarisStorageConfigurationInfo;
import org.apache.polaris.core.storage.PolarisStorageIntegration;
+import org.jetbrains.annotations.NotNull;
Review Comment:
#1176
--
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