alamb commented on code in PR #3600:
URL: https://github.com/apache/arrow-datafusion/pull/3600#discussion_r979231595
##########
datafusion-examples/examples/dataframe_in_memory.rs:
##########
@@ -47,8 +46,7 @@ async fn main() -> Result<()> {
let ctx = SessionContext::new();
// declare a table in memory. In spark API, this corresponds to
createDataFrame(...).
- let provider = MemTable::try_new(schema, vec![vec![batch]])?;
- ctx.register_table("t", Arc::new(provider))?;
+ ctx.register_batch("t", batch)?;
Review Comment:
❤️
##########
datafusion/core/src/execution/context.rs:
##########
@@ -230,6 +231,16 @@ impl SessionContext {
self.table_factories.insert(file_type.to_string(), factory);
}
+ /// Registers the RecordBatch as the specified table name
Review Comment:
```suggestion
/// Registers the [`RecordBatch`] as the specified table name
```
##########
datafusion/core/src/execution/context.rs:
##########
@@ -713,6 +724,20 @@ impl SessionContext {
)))
}
+ /// Creates a DataFrame for reading a custom RecordBatch
Review Comment:
```suggestion
/// Creates a [`DataFrame`] for reading a single [`RecordBatch`]
```
##########
datafusion/core/src/dataframe.rs:
##########
@@ -1361,10 +1361,8 @@ mod tests {
],
)?;
- let table = crate::datasource::MemTable::try_new(schema,
vec![vec![data]])?;
-
let ctx = SessionContext::new();
- ctx.register_table("test", Arc::new(table))?;
+ ctx.register_batch("test", data)?;
Review Comment:
its so much nicer
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]