-
Notifications
You must be signed in to change notification settings - Fork 150
Add missing deregister methods to SessionContext #1473
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
base: main
Are you sure you want to change the base?
Changes from all commits
03fde8a
9169146
b3bd04b
79e3546
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -568,6 +568,15 @@ def register_object_store( | |
| """ | ||
| self.ctx.register_object_store(schema, store, host) | ||
|
|
||
| def deregister_object_store(self, schema: str, host: str | None = None) -> None: | ||
| """Remove an object store from the session. | ||
|
|
||
| Args: | ||
| schema: The data source schema (e.g. ``"s3://"``). | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Would be nice to add this |
||
| host: URL for the host (e.g. bucket name). | ||
| """ | ||
| self.ctx.deregister_object_store(schema, host) | ||
timsaucer marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| def register_listing_table( | ||
| self, | ||
| name: str, | ||
|
|
@@ -894,6 +903,14 @@ def register_udtf(self, func: TableFunction) -> None: | |
| """Register a user defined table function.""" | ||
| self.ctx.register_udtf(func._udtf) | ||
|
|
||
| def deregister_udtf(self, name: str) -> None: | ||
| """Remove a user-defined table function from the session. | ||
|
|
||
| Args: | ||
| name: Name of the UDTF to deregister. | ||
| """ | ||
| self.ctx.deregister_udtf(name) | ||
|
|
||
| def register_record_batches( | ||
| self, name: str, partitions: list[list[pa.RecordBatch]] | ||
| ) -> None: | ||
|
|
@@ -1105,14 +1122,38 @@ def register_udf(self, udf: ScalarUDF) -> None: | |
| """Register a user-defined function (UDF) with the context.""" | ||
| self.ctx.register_udf(udf._udf) | ||
|
|
||
| def deregister_udf(self, name: str) -> None: | ||
| """Remove a user-defined scalar function from the session. | ||
|
|
||
| Args: | ||
| name: Name of the UDF to deregister. | ||
| """ | ||
| self.ctx.deregister_udf(name) | ||
|
|
||
| def register_udaf(self, udaf: AggregateUDF) -> None: | ||
| """Register a user-defined aggregation function (UDAF) with the context.""" | ||
| self.ctx.register_udaf(udaf._udaf) | ||
|
|
||
| def deregister_udaf(self, name: str) -> None: | ||
| """Remove a user-defined aggregate function from the session. | ||
|
|
||
| Args: | ||
| name: Name of the UDAF to deregister. | ||
| """ | ||
| self.ctx.deregister_udaf(name) | ||
|
|
||
| def register_udwf(self, udwf: WindowUDF) -> None: | ||
| """Register a user-defined window function (UDWF) with the context.""" | ||
| self.ctx.register_udwf(udwf._udwf) | ||
|
|
||
| def deregister_udwf(self, name: str) -> None: | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. For all these deregister calls I assume they are for long running sessions and people aren't regularly registering and unregistering in quick succession. If they were then a context manager might be nice to manage scoped lifetimes. Probably out of scope for here or unless someone asks for it. |
||
| """Remove a user-defined window function from the session. | ||
|
|
||
| Args: | ||
| name: Name of the UDWF to deregister. | ||
| """ | ||
| self.ctx.deregister_udwf(name) | ||
|
|
||
| def catalog(self, name: str = "datafusion") -> Catalog: | ||
| """Retrieve a catalog by name.""" | ||
| return Catalog(self.ctx.catalog(name)) | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.