This is an automated email from the ASF dual-hosted git repository.
github-bot pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/datafusion.git
The following commit(s) were added to refs/heads/main by this push:
new b61aee77c8 Minor: make signatures of `SessionContext::register_*`
methods consistent (#20873)
b61aee77c8 is described below
commit b61aee77c849be3fb5391311870db41519ab6612
Author: Alexandre Crayssac <[email protected]>
AuthorDate: Mon Mar 16 14:40:01 2026 +0100
Minor: make signatures of `SessionContext::register_*` methods consistent
(#20873)
## Which issue does this PR close?
None.
## Rationale for this change
All `register_*` methods on `SessionContext` should have similar
signatures for the sake of API consistency.
## What changes are included in this PR?
Update `SessionContext::register_batch` and
`SessionContext::register_arrow` to have similar signatures than the
rest of `SessionContext::register_*` methods.
## Are these changes tested?
I don't think any tests are required for this. Type checking done by the
compiler should be enough. Let me know if you disagree.
## Are there any user-facing changes?
I don't think so. All previous calls to these methods should still work
as before.
Co-authored-by: alexandreyc <[email protected]>
---
datafusion/core/src/execution/context/mod.rs | 18 ++++++------------
1 file changed, 6 insertions(+), 12 deletions(-)
diff --git a/datafusion/core/src/execution/context/mod.rs
b/datafusion/core/src/execution/context/mod.rs
index ad254d61b5..5dbae61fc5 100644
--- a/datafusion/core/src/execution/context/mod.rs
+++ b/datafusion/core/src/execution/context/mod.rs
@@ -530,19 +530,14 @@ impl SessionContext {
self.runtime_env().deregister_object_store(url)
}
- /// Registers the [`RecordBatch`] as the specified table name
+ /// Registers the given [`RecordBatch`] as the specified table reference.
pub fn register_batch(
&self,
- table_name: &str,
+ table_ref: impl Into<TableReference>,
batch: RecordBatch,
) -> Result<Option<Arc<dyn TableProvider>>> {
let table = MemTable::try_new(batch.schema(), vec![vec![batch]])?;
- self.register_table(
- TableReference::Bare {
- table: table_name.into(),
- },
- Arc::new(table),
- )
+ self.register_table(table_ref, Arc::new(table))
}
/// Return the [RuntimeEnv] used to run queries with this `SessionContext`
@@ -1788,15 +1783,14 @@ impl SessionContext {
/// SQL statements executed against this context.
pub async fn register_arrow(
&self,
- name: &str,
- table_path: &str,
+ table_ref: impl Into<TableReference>,
+ table_path: impl AsRef<str>,
options: ArrowReadOptions<'_>,
) -> Result<()> {
let listing_options = options
.to_listing_options(&self.copied_config(),
self.copied_table_options());
-
self.register_listing_table(
- name,
+ table_ref,
table_path,
listing_options,
options.schema.map(|s| Arc::new(s.to_owned())),
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]