Skip to content

Conversation

@travis-bowen
Copy link
Contributor

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, 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 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
Screenshot 2026-02-06 at 3 57 35 PM
Screenshot 2026-02-06 at 3 57 21 PM

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)

flyrain
flyrain previously approved these changes Feb 7, 2026
Copy link
Contributor

@flyrain flyrain left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @travis-bowen for the fix. LGTM overall. Left a few minor comments.

I'm not a big fan of the BaseResult and its subclasses, I think a better way is to create a set of exceptions which can be threw from the persistence layer(AtomicOperationMetaStoreManager, TransactionalMetaStoreManagerImpl). It's a different topic and fairly big change though. We could handle that later.

@github-project-automation github-project-automation bot moved this from PRs In Progress to Ready to merge in Basic Kanban Board Feb 7, 2026
Copy link
Contributor

@HonahX HonahX left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall LGTM!
Quick question: Do we need ENTITY_UNDROPPABLE for table/view? I remember this is for service_admin and catalog_admin role which are not droppable.

Copy link
Contributor

@HonahX HonahX left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall LGTM!

return false;

case BaseResult.ReturnStatus.ENTITY_UNDROPPABLE:
throw new ForbiddenException(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need this for table/view? I remember this is for service_admin and catalog_admin role which are not droppable.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants