Skip to content

Commit

Permalink
add parquet example (#80)
Browse files Browse the repository at this point in the history
Change-Id: Id642fcfdf4cd2e8a8bc7a1f01d596082bad0ca59
  • Loading branch information
wangfenjin authored Sep 10, 2022
1 parent 42abf91 commit 37f91c7
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
Binary file added examples/int32_decimal.parquet
Binary file not shown.
16 changes: 16 additions & 0 deletions examples/parquet.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
extern crate duckdb;
use duckdb::{Connection, Result};

use arrow::record_batch::RecordBatch;
use arrow::util::pretty::print_batches;

fn main() -> Result<()> {
let db = Connection::open_in_memory()?;
db.execute_batch("INSTALL parquet; LOAD parquet;")?;
let rbs: Vec<RecordBatch> = db
.prepare("SELECT * FROM read_parquet('./examples/int32_decimal.parquet');")?
.query_arrow([])?
.collect();
assert!(print_batches(&rbs).is_ok());
Ok(())
}

0 comments on commit 37f91c7

Please sign in to comment.