Created
February 8, 2022 16:22
-
-
Save joshuarobinson/413536d5affd751eb9d8958a970e8b04 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use std::env; | |
use datafusion::arrow::util::pretty; | |
use datafusion::error::Result; | |
use datafusion::prelude::*; | |
/// This example demonstrates executing a simple query against an Arrow data source (Avro) and | |
/// fetching results | |
#[tokio::main] | |
async fn main() -> Result<()> { | |
let args: Vec<String> = env::args().collect(); | |
let avro_file = &args[1]; | |
// create local execution context | |
let mut ctx = ExecutionContext::new(); | |
// register avro file with the execution context | |
let df = ctx.read_avro(avro_file, AvroReadOptions::default()).await?; | |
let results = df.collect().await?; | |
// print the results | |
pretty::print_batches(&results)?; | |
Ok(()) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment