You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by GitBox <gi...@apache.org> on 2021/12/03 16:07:45 UTC
[GitHub] [arrow-datafusion] capkurmagati commented on issue #1396: Caching datasets in context [Question]
capkurmagati commented on issue #1396:
URL: https://github.com/apache/arrow-datafusion/issues/1396#issuecomment-985641504
I think you can do something like this.
```rust
let mut ctx = ExecutionContext::new();
// read a file
ctx.register_csv("c", "path_to_csv", CsvReadOptions::new()).await?;
let df = ctx.sql("select * from c").await?;
let partitions = df.collect().await?;
// convert it into a memory table and register it to the context
let provider = MemTable::try_new(Arc::new(df.schema().into()), vec![partitions])?;
ctx.register_table("t", Arc::new(provider)).unwrap();
let df = ctx.sql("select * from t").await?;
df.show().await?;
```
--
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: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org