Compare commits
No commits in common. "50c0e0d22484fc824ebc3729b53ea727df5f6876" and "6198dcb40dff55913936d053f1396f1dc9d1a544" have entirely different histories.
50c0e0d224
...
6198dcb40d
1 changed files with 16 additions and 2 deletions
18
src/main.rs
18
src/main.rs
|
@ -16,6 +16,13 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||||
set preserve_insertion_order = false;
|
set preserve_insertion_order = false;
|
||||||
"#,
|
"#,
|
||||||
)?;
|
)?;
|
||||||
|
let mut stmt = conn.prepare("select * from duckdb_settings()")?;
|
||||||
|
let mut rows = stmt.query([])?;
|
||||||
|
while let Some(row) = rows.next()? {
|
||||||
|
let name: String = row.get(0)?;
|
||||||
|
let value: String = row.get(1)?;
|
||||||
|
println!("{}: {}", name, value);
|
||||||
|
}
|
||||||
let xmin = -97.734375;
|
let xmin = -97.734375;
|
||||||
let xmax = -97.3828125;
|
let xmax = -97.3828125;
|
||||||
let ymin = 30.234375;
|
let ymin = 30.234375;
|
||||||
|
@ -30,13 +37,20 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||||
let table = t.split('=');
|
let table = t.split('=');
|
||||||
let table = table.last().unwrap();
|
let table = table.last().unwrap();
|
||||||
let root = format!("{ROOT}/{t}/*");
|
let root = format!("{ROOT}/{t}/*");
|
||||||
|
println!("Making table");
|
||||||
println!(
|
println!(
|
||||||
r#"create table {table} as select * from read_parquet("{root}") where bbox.xmin between {xmin} and {xmax} and bbox.ymin between {ymin} and {ymax};"#
|
r#"create table {table} as select * from read_parquet("{root}") where bbox.xmin between {xmin} and {xmax} and bbox.ymin between {ymin} and {ymax};"#
|
||||||
);
|
);
|
||||||
let query = format!(
|
let query = format!(
|
||||||
r#"create table {table} as select * from read_parquet(?) where bbox.xmin between {xmin} and {xmax} and bbox.ymin between {ymin} and {ymax};"#
|
r#"create table {table} as select * from read_parquet(?) where bbox.xmin between ? and ? and bbox.ymin between ? and ?;"#
|
||||||
);
|
);
|
||||||
conn.execute(&query, params![root,])?;
|
conn.execute(&query, params![root, xmin, xmax, ymin, ymax,])?;
|
||||||
|
println!("Counting");
|
||||||
|
conn.query_row(&format!("select count() from {table};"), [], |row| {
|
||||||
|
let count: usize = row.get(0).unwrap();
|
||||||
|
println!("{count}");
|
||||||
|
Ok(())
|
||||||
|
})?;
|
||||||
}
|
}
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue