Skip to content

Commit 79ed15a

Browse files
committed
Fix Parquet example to run from workspace root
1 parent 43e95cc commit 79ed15a

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

crates/duckdb/examples/parquet.rs

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,23 @@
1+
use std::path::PathBuf;
2+
13
use duckdb::{
24
arrow::{record_batch::RecordBatch, util::pretty::print_batches},
35
Connection, Result,
46
};
57

68
fn main() -> Result<()> {
79
let db = Connection::open_in_memory()?;
10+
811
db.execute_batch("INSTALL parquet; LOAD parquet;")?;
12+
13+
let parquet_path = PathBuf::from(env!("CARGO_MANIFEST_DIR")).join("examples/int32_decimal.parquet");
14+
915
let rbs: Vec<RecordBatch> = db
10-
.prepare("SELECT * FROM read_parquet('./examples/int32_decimal.parquet');")?
11-
.query_arrow([])?
16+
.prepare("SELECT * FROM read_parquet(?)")?
17+
.query_arrow([parquet_path.to_string_lossy()])?
1218
.collect();
19+
1320
assert!(print_batches(&rbs).is_ok());
21+
1422
Ok(())
1523
}

0 commit comments

Comments
 (0)