remove as_any from TableProvider, SchemaProvider, CatalogProvider, and CatalogProviderList#21346
Open
timsaucer wants to merge 6 commits intoapache:mainfrom
Open
remove as_any from TableProvider, SchemaProvider, CatalogProvider, and CatalogProviderList#21346timsaucer wants to merge 6 commits intoapache:mainfrom
timsaucer wants to merge 6 commits intoapache:mainfrom
Conversation
Now that Any is a supertrait of TableProvider via trait upcasting (Rust 1.86+), the as_any boilerplate is no longer needed. This adds is() and downcast_ref() helper methods on dyn TableProvider and removes as_any from the trait and all implementations. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
TableProvider already requires Send as a supertrait, so the explicit + Send is unnecessary and prevented using the new downcast_ref method directly. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Now that Any is a supertrait of SchemaProvider via trait upcasting (Rust 1.86+), the as_any boilerplate is no longer needed. This adds is() and downcast_ref() helper methods on dyn SchemaProvider and removes as_any from the trait and all implementations. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Now that Any is a supertrait of CatalogProvider via trait upcasting (Rust 1.86+), the as_any boilerplate is no longer needed. This adds is() and downcast_ref() helper methods on dyn CatalogProvider and removes as_any from the trait and all implementations. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Now that Any is a supertrait of CatalogProviderList via trait upcasting (Rust 1.86+), the as_any boilerplate is no longer needed. This adds is() and downcast_ref() helper methods on dyn CatalogProviderList and removes as_any from the trait and all implementations. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
timsaucer
commented
Apr 3, 2026
| unsafe impl Sync for FFI_CatalogProvider {} | ||
|
|
||
| struct ProviderPrivateData { | ||
| provider: Arc<dyn CatalogProvider + Send>, |
Member
Author
There was a problem hiding this comment.
CatalogProvider is already Send so this is unnecessary
| unsafe impl Sync for FFI_CatalogProviderList {} | ||
|
|
||
| struct ProviderPrivateData { | ||
| provider: Arc<dyn CatalogProviderList + Send>, |
Member
Author
There was a problem hiding this comment.
CatalogProviderList is already Send so this is unnecessary
| unsafe impl Sync for FFI_SchemaProvider {} | ||
|
|
||
| struct ProviderPrivateData { | ||
| provider: Arc<dyn SchemaProvider + Send>, |
Member
Author
There was a problem hiding this comment.
SchemaProvider is already Send so this is unnecessary
| unsafe impl Sync for FFI_TableProvider {} | ||
|
|
||
| struct ProviderPrivateData { | ||
| provider: Arc<dyn TableProvider + Send>, |
Member
Author
There was a problem hiding this comment.
TableProvider is already Send so this is unnecessary
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Which issue does this PR close?
This is a follow on to #20812 #21209 #21263 but treats
TableProvider,SchemaProvider,CatalogProvider, andCatalogProviderList.Rationale for this change
This PR reduces the amount of boilerplate code that users need to write for catalogs through table providers.
What changes are included in this PR?
Now that we have trait upcasting since rust 1.86, we no longer need every implementation of these functions to have the as_any function that returns &self. This PR makes Any an supertrait and makes the appropriate casts when necessary.
Are these changes tested?
Existing unit tests.
Are there any user-facing changes?
Yes, the users simply need to remove the
as_anyfunction. The upgrade guide is updated.