Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Decorator trait #26

Merged
merged 2 commits into from
Jan 8, 2025
Merged

Conversation

suremarc
Copy link
Collaborator

@suremarc suremarc commented Jan 8, 2025

This PR adds a new Decorator API that allows users of this library to register decorator implementations of TableProvider.

Decorators are useful for overriding functionality of existing TableProvider implementations. Sometimes, a user may implemented Materialized or ListingTableLike for a TableProvider, but then wrap this type with a decorator that doesn't implement either. In this case, whether or not the inner table implements Materialized or TableProvider can only be known at runtime by inspecting the inner TableProvider.

To simplify dealing with such cases, the user may register their decorator using register_decorator. For such types, if the cast_to_listing_table and cast_to_materialized functions fail, it will then check if the table is a decorator. If so, it will recursively check the inner table as well.

@suremarc suremarc merged commit 64eaabd into datafusion-contrib:main Jan 8, 2025
8 checks passed
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.

1 participant