From 3daef343b9533c01a4e9e446bc57e7015b6de651 Mon Sep 17 00:00:00 2001 From: Kould <2435992353@qq.com> Date: Fri, 6 Oct 2023 01:24:54 +0800 Subject: [PATCH] config: `kipdb` version up (#80) --- Cargo.toml | 2 +- src/execution/executor/dml/copy_from_file.rs | 10 ++++++---- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 223881a9..228c96d8 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -37,7 +37,7 @@ ahash = "0.8.3" lazy_static = "1.4.0" comfy-table = "7.0.1" bytes = "1.5.0" -kip_db = "0.1.2-alpha.16" +kip_db = "0.1.2-alpha.17" async-recursion = "1.0.5" rust_decimal = "1" csv = "1" diff --git a/src/execution/executor/dml/copy_from_file.rs b/src/execution/executor/dml/copy_from_file.rs index 561d781a..e560aacd 100644 --- a/src/execution/executor/dml/copy_from_file.rs +++ b/src/execution/executor/dml/copy_from_file.rs @@ -114,7 +114,7 @@ fn return_result(size: usize, tx: Sender) -> Result<(), ExecutorError> { #[cfg(test)] mod tests { use crate::catalog::{ColumnCatalog, ColumnDesc}; - use crate::db::Database; + use crate::db::{Database, DatabaseError}; use futures::StreamExt; use std::io::Write; use std::sync::Arc; @@ -125,7 +125,7 @@ mod tests { use crate::types::LogicalType; #[tokio::test] - async fn read_csv() { + async fn read_csv() -> Result<(), DatabaseError> { let csv = "1,1.5,one\n2,2.5,two\n"; let mut file = tempfile::NamedTempFile::new().expect("failed to create temp file"); @@ -189,16 +189,18 @@ mod tests { }; let temp_dir = TempDir::new().unwrap(); - let db = Database::with_kipdb(temp_dir.path()).await.unwrap(); + let db = Database::with_kipdb(temp_dir.path()).await?; let _ = db .run("create table test_copy (a int primary key, b float, c varchar(10))") .await; - let actual = executor.execute(&db.storage).next().await.unwrap().unwrap(); + let actual = executor.execute(&db.storage).next().await.unwrap()?; let tuple_builder = TupleBuilder::new_result(); let expected = tuple_builder .push_result("COPY FROM SOURCE", format!("import {} rows", 2).as_str()) .unwrap(); assert_eq!(actual, expected); + + Ok(()) } }