You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@polaris.apache.org by "travis-bowen (via GitHub)" <gi...@apache.org> on 2026/02/06 23:59:51 UTC
[PR] Correctly Propagate Errors from Drop Entities [polaris]
travis-bowen opened a new pull request, #3693:
URL: https://github.com/apache/polaris/pull/3693
During drop commands, Apache Polaris would make assumptions based on the entity type as to why the entity could not be dropped which could lead to incorrect user error messaging and handling.
Here I tackle updating error handling for DropTable, DropNamespace, and DropView.
The Catalog API javadocs by Iceberg indicate false should indicate [TableNotExists] (and simila for View) (https://github.com/apache/iceberg/blob/a8ece055ba93adc0c046db29b6b7b5edaf35d4da/api/src/main/java/org/apache/iceberg/catalog/Catalog.java#L292).
For Namespaces [it's less clear]((https://github.com/apache/iceberg/blob/a8ece055ba93adc0c046db29b6b7b5edaf35d4da/api/src/main/java/org/apache/iceberg/catalog/SupportsNamespaces.java#L120) ), but I assume the same holds and we treat it to follow the same logic that false = Not Found in CatalogHandlerUtils.
**Before**
Any non success in Polaris's IcebergCatalog impl would return false.
Polaris's [CatalogHandlerUtils](https://github.com/apache/polaris/blob/6a516e0976f549ec4326f1de6b1324520c2a1f38/runtime/service/src/main/java/org/apache/polaris/service/catalog/iceberg/CatalogHandlerUtils.java#L364) would interpret this false to mean the entity did not exist and would throw the appropriate does not exist error
However, the reason that it returned false, may not truly be that it didn't exist.
**After**
The IcebergCatalog impl in Polaris uses the return status of the persistence result to determine whether or not the drop failure was due to being not found. If not found, it returns false per the interface definition, which the CatalogHandlerUtil transforms into the appropriate not found exception. Otherwise it throws it's own error corresponding to the cause.
Ran tests locally + S3 Tests with drop
<img width="1470" height="235" alt="Screenshot 2026-02-06 at 3 57 35 PM" src="https://github.com/user-attachments/assets/ad9e9647-7fd9-4812-a63a-16488a3ad590" />
<img width="1133" height="60" alt="Screenshot 2026-02-06 at 3 57 21 PM" src="https://github.com/user-attachments/assets/cd70e96c-6e92-4135-8c14-67eeda0d4267" />
## 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] Correctly Propagate Errors from Drop Entities [polaris]
Posted by "flyrain (via GitHub)" <gi...@apache.org>.
flyrain commented on code in PR #3693:
URL: https://github.com/apache/polaris/pull/3693#discussion_r2778210139
##########
runtime/service/src/main/java/org/apache/polaris/service/catalog/iceberg/IcebergCatalog.java:
##########
@@ -648,12 +663,23 @@ public boolean dropNamespace(Namespace namespace) throws NamespaceNotEmptyExcept
Map.of(),
realmConfig.getConfig(FeatureConfiguration.CLEANUP_ON_NAMESPACE_DROP));
- if (!dropEntityResult.isSuccess() && dropEntityResult.failedBecauseNotEmpty()) {
- throw new NamespaceNotEmptyException("Namespace %s is not empty", namespace);
+ if (!dropEntityResult.isSuccess()) {
+ switch (dropEntityResult.getReturnStatus()) {
+ case BaseResult.ReturnStatus.NAMESPACE_NOT_EMPTY:
+ case BaseResult.ReturnStatus.CATALOG_NOT_EMPTY:
Review Comment:
Is `CATALOG_NOT_EMPTY` a valid status here?
--
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] Correctly Propagate Errors from Drop Entities [polaris]
Posted by "flyrain (via GitHub)" <gi...@apache.org>.
flyrain merged PR #3693:
URL: https://github.com/apache/polaris/pull/3693
--
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] Correctly Propagate Errors from Drop Entities [polaris]
Posted by "flyrain (via GitHub)" <gi...@apache.org>.
flyrain commented on code in PR #3693:
URL: https://github.com/apache/polaris/pull/3693#discussion_r2778208409
##########
runtime/service/src/main/java/org/apache/polaris/service/catalog/iceberg/IcebergCatalog.java:
##########
@@ -835,8 +861,26 @@ public boolean dropView(TableIdentifier identifier) {
boolean purge =
realmConfig.getConfig(FeatureConfiguration.PURGE_VIEW_METADATA_ON_DROP, catalogEntity);
- return dropTableLike(PolarisEntitySubType.ICEBERG_VIEW, identifier, Map.of(), purge)
- .isSuccess();
+ DropEntityResult dropEntityResult =
+ dropTableLike(PolarisEntitySubType.ICEBERG_VIEW, identifier, Map.of(), purge);
+ if (!dropEntityResult.isSuccess()) {
+ switch (dropEntityResult.getReturnStatus()) {
+ case BaseResult.ReturnStatus.ENTITY_NOT_FOUND:
+ return false;
+
+ case BaseResult.ReturnStatus.ENTITY_UNDROPPABLE:
+ throw new ForbiddenException(
+ "View %s cannot be dropped: %s", identifier, dropEntityResult.getExtraInformation());
+
+ default:
+ throw new ServiceFailureException(
+ "Unexpected error dropping view %s: %s. ExtraInfo: %s",
Review Comment:
Minor: Failed to drop view %s, status=%s, extraInfo=%s?
--
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] Correctly Propagate Errors from Drop Entities [polaris]
Posted by "flyrain (via GitHub)" <gi...@apache.org>.
flyrain commented on PR #3693:
URL: https://github.com/apache/polaris/pull/3693#issuecomment-3892510968
Thanks @travis-bowen for the fix, and thanks @HonahX for the review.
--
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] Correctly Propagate Errors from Drop Entities [polaris]
Posted by "travis-bowen (via GitHub)" <gi...@apache.org>.
travis-bowen commented on code in PR #3693:
URL: https://github.com/apache/polaris/pull/3693#discussion_r2784198373
##########
runtime/service/src/main/java/org/apache/polaris/service/catalog/iceberg/IcebergCatalog.java:
##########
@@ -423,7 +423,22 @@ public boolean dropTable(TableIdentifier tableIdentifier, boolean purge) {
dropTableLike(
PolarisEntitySubType.ICEBERG_TABLE, tableIdentifier, storageProperties, purge);
if (!dropEntityResult.isSuccess()) {
- return false;
+ switch (dropEntityResult.getReturnStatus()) {
+ case BaseResult.ReturnStatus.ENTITY_NOT_FOUND:
+ return false;
+
+ case BaseResult.ReturnStatus.ENTITY_UNDROPPABLE:
+ throw new ForbiddenException(
Review Comment:
You're right - we don't need it. I lean towards keeping it since we can't be certain of any custom implementations but I'm not tied to keeping it if you feel strongly.
--
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] Correctly Propagate Errors from Drop Entities [polaris]
Posted by "flyrain (via GitHub)" <gi...@apache.org>.
flyrain commented on code in PR #3693:
URL: https://github.com/apache/polaris/pull/3693#discussion_r2778090447
##########
runtime/service/src/main/java/org/apache/polaris/service/catalog/iceberg/IcebergCatalog.java:
##########
@@ -423,7 +423,22 @@ public boolean dropTable(TableIdentifier tableIdentifier, boolean purge) {
dropTableLike(
PolarisEntitySubType.ICEBERG_TABLE, tableIdentifier, storageProperties, purge);
if (!dropEntityResult.isSuccess()) {
- return false;
+ switch (dropEntityResult.getReturnStatus()) {
+ case BaseResult.ReturnStatus.ENTITY_NOT_FOUND:
+ return false;
+
+ case BaseResult.ReturnStatus.ENTITY_UNDROPPABLE:
+ throw new ForbiddenException(
+ "Table %s cannot be dropped: %s",
+ tableIdentifier, dropEntityResult.getExtraInformation());
+
+ default:
+ throw new ServiceFailureException(
+ "Unexpected error dropping table %s: %s. ExtraInfo: %s",
Review Comment:
Minor:
```suggestion
"Failed to drop table %s, status=%s, extraInfo=%s",
```
--
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] Correctly Propagate Errors from Drop Entities [polaris]
Posted by "HonahX (via GitHub)" <gi...@apache.org>.
HonahX commented on code in PR #3693:
URL: https://github.com/apache/polaris/pull/3693#discussion_r2785690138
##########
runtime/service/src/main/java/org/apache/polaris/service/catalog/iceberg/IcebergCatalog.java:
##########
@@ -423,7 +423,22 @@ public boolean dropTable(TableIdentifier tableIdentifier, boolean purge) {
dropTableLike(
PolarisEntitySubType.ICEBERG_TABLE, tableIdentifier, storageProperties, purge);
if (!dropEntityResult.isSuccess()) {
- return false;
+ switch (dropEntityResult.getReturnStatus()) {
+ case BaseResult.ReturnStatus.ENTITY_NOT_FOUND:
+ return false;
+
+ case BaseResult.ReturnStatus.ENTITY_UNDROPPABLE:
+ throw new ForbiddenException(
Review Comment:
I am ok to keep it. I feel like we probably should not group all the returnStatus in a single place.. but as Yufei mentioned that's a follow-up thing
--
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] Correctly Propagate Errors from Drop Entities [polaris]
Posted by "flyrain (via GitHub)" <gi...@apache.org>.
flyrain commented on code in PR #3693:
URL: https://github.com/apache/polaris/pull/3693#discussion_r2778208157
##########
runtime/service/src/main/java/org/apache/polaris/service/catalog/iceberg/IcebergCatalog.java:
##########
@@ -648,12 +663,23 @@ public boolean dropNamespace(Namespace namespace) throws NamespaceNotEmptyExcept
Map.of(),
realmConfig.getConfig(FeatureConfiguration.CLEANUP_ON_NAMESPACE_DROP));
- if (!dropEntityResult.isSuccess() && dropEntityResult.failedBecauseNotEmpty()) {
- throw new NamespaceNotEmptyException("Namespace %s is not empty", namespace);
+ if (!dropEntityResult.isSuccess()) {
+ switch (dropEntityResult.getReturnStatus()) {
+ case BaseResult.ReturnStatus.NAMESPACE_NOT_EMPTY:
+ case BaseResult.ReturnStatus.CATALOG_NOT_EMPTY:
+ throw new NamespaceNotEmptyException("Namespace %s is not empty", namespace);
+
+ case BaseResult.ReturnStatus.ENTITY_NOT_FOUND:
+ return false;
+
+ default:
+ throw new ServiceFailureException(
+ "Unexpected error dropping namespace %s: %s. ExtraInfo: %s",
Review Comment:
Minor: "Failed to drop namespace %s, status=%s, extraInfo=%s"?
--
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] Correctly Propagate Errors from Drop Entities [polaris]
Posted by "flyrain (via GitHub)" <gi...@apache.org>.
flyrain closed pull request #3693: Correctly Propagate Errors from Drop Entities
URL: https://github.com/apache/polaris/pull/3693
--
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] Correctly Propagate Errors from Drop Entities [polaris]
Posted by "HonahX (via GitHub)" <gi...@apache.org>.
HonahX commented on code in PR #3693:
URL: https://github.com/apache/polaris/pull/3693#discussion_r2784163211
##########
runtime/service/src/main/java/org/apache/polaris/service/catalog/iceberg/IcebergCatalog.java:
##########
@@ -423,7 +423,22 @@ public boolean dropTable(TableIdentifier tableIdentifier, boolean purge) {
dropTableLike(
PolarisEntitySubType.ICEBERG_TABLE, tableIdentifier, storageProperties, purge);
if (!dropEntityResult.isSuccess()) {
- return false;
+ switch (dropEntityResult.getReturnStatus()) {
+ case BaseResult.ReturnStatus.ENTITY_NOT_FOUND:
+ return false;
+
+ case BaseResult.ReturnStatus.ENTITY_UNDROPPABLE:
+ throw new ForbiddenException(
Review Comment:
Do we need this for table/view? I remember this is for `service_admin` and `catalog_admin` role which are not droppable.
--
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] Correctly Propagate Errors from Drop Entities [polaris]
Posted by "travis-bowen (via GitHub)" <gi...@apache.org>.
travis-bowen commented on code in PR #3693:
URL: https://github.com/apache/polaris/pull/3693#discussion_r2784170500
##########
runtime/service/src/main/java/org/apache/polaris/service/catalog/iceberg/IcebergCatalog.java:
##########
@@ -648,12 +663,23 @@ public boolean dropNamespace(Namespace namespace) throws NamespaceNotEmptyExcept
Map.of(),
realmConfig.getConfig(FeatureConfiguration.CLEANUP_ON_NAMESPACE_DROP));
- if (!dropEntityResult.isSuccess() && dropEntityResult.failedBecauseNotEmpty()) {
- throw new NamespaceNotEmptyException("Namespace %s is not empty", namespace);
+ if (!dropEntityResult.isSuccess()) {
+ switch (dropEntityResult.getReturnStatus()) {
+ case BaseResult.ReturnStatus.NAMESPACE_NOT_EMPTY:
+ case BaseResult.ReturnStatus.CATALOG_NOT_EMPTY:
Review Comment:
So I also think it feels weird, but it is what the existing method uses, so I kept it to minimize logic changes.
https://github.com/apache/polaris/blob/7de070d59008afa6d369268cec88f27d555ead7b/polaris-core/src/main/java/org/apache/polaris/core/persistence/dao/entity/DropEntityResult.java#L76
--
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