Compare commits
3 commits
6198dcb40d
...
50c0e0d224
Author | SHA1 | Date | |
---|---|---|---|
50c0e0d224 | |||
4b3e57be44 | |||
41c6a7ebba |
1 changed files with 2 additions and 16 deletions
18
src/main.rs
18
src/main.rs
|
@ -16,13 +16,6 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
|
|||
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 xmax = -97.3828125;
|
||||
let ymin = 30.234375;
|
||||
|
@ -37,20 +30,13 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
|
|||
let table = t.split('=');
|
||||
let table = table.last().unwrap();
|
||||
let root = format!("{ROOT}/{t}/*");
|
||||
println!("Making table");
|
||||
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};"#
|
||||
);
|
||||
let query = format!(
|
||||
r#"create table {table} as select * from read_parquet(?) where bbox.xmin between ? and ? and bbox.ymin between ? and ?;"#
|
||||
r#"create table {table} as select * from read_parquet(?) where bbox.xmin between {xmin} and {xmax} and bbox.ymin between {ymin} and {ymax};"#
|
||||
);
|
||||
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(())
|
||||
})?;
|
||||
conn.execute(&query, params![root,])?;
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue