Skip to content

Commit 211bc3d

Browse files
committed
Verify the data is correct
1 parent ab9ddbe commit 211bc3d

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

crates/duckdb/src/appender/arrow.rs

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -103,17 +103,20 @@ mod test {
103103
let db = Connection::open_in_memory()?;
104104
db.execute_batch("CREATE TABLE foo(id INT)")?;
105105
{
106-
let id_array = Int32Array::from(vec![42; record_count]);
106+
let id_array = Int32Array::from((0..record_count as i32).collect::<Vec<_>>());
107107
let schema = Schema::new(vec![Field::new("id", DataType::Int32, true)]);
108108
let record_batch = RecordBatch::try_new(Arc::new(schema), vec![Arc::new(id_array)]).unwrap();
109109
let mut app = db.appender("foo")?;
110110
app.append_record_batch(record_batch)?;
111111
}
112-
let count = db.query_row("SELECT COUNT(*) FROM foo", [], |row| {
113-
let count: usize = row.get(0)?;
114-
Ok(count)
115-
})?;
112+
let count: usize = db.query_row("SELECT COUNT(*) FROM foo", [], |row| row.get(0))?;
116113
assert_eq!(count, record_count);
114+
115+
// Verify the data is correct
116+
let sum: i64 = db.query_row("SELECT SUM(id) FROM foo", [], |row| row.get(0))?;
117+
let expected_sum: i64 = (0..record_count as i64).sum();
118+
assert_eq!(sum, expected_sum);
119+
117120
Ok(())
118121
}
119122
}

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy