From a88c221bb604facdf791936887d2797e84ec9deb Mon Sep 17 00:00:00 2001 From: alexandreyc Date: Wed, 11 Mar 2026 17:09:17 +0100 Subject: [PATCH] Minor: make signatures of `register_batch` and `register_arrow` consistent with the rest of `register_*` methods --- 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 58d433e7dd0c1..d90f5e1164ad6 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, batch: RecordBatch, ) -> Result>> { 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` @@ -1758,15 +1753,14 @@ impl SessionContext { /// SQL statements executed against this context. pub async fn register_arrow( &self, - name: &str, - table_path: &str, + table_ref: impl Into, + table_path: impl AsRef, 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())),