Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 6 additions & 12 deletions datafusion/core/src/execution/context/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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`
Expand Down Expand Up @@ -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<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())),
Expand Down
Loading