From e7ef64e4a10d85d25634c5c1c0861012268a549c Mon Sep 17 00:00:00 2001 From: Vedat Can Keklik Date: Thu, 24 Oct 2024 20:47:31 +0300 Subject: [PATCH] fix: Test case, pretty print --- lykiadb-server/Cargo.toml | 1 + lykiadb-server/tests/planner/join | 14 ++++++++++---- lykiadb-server/tests/util.rs | 1 + 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/lykiadb-server/Cargo.toml b/lykiadb-server/Cargo.toml index 2db3eaeb..e40f3279 100644 --- a/lykiadb-server/Cargo.toml +++ b/lykiadb-server/Cargo.toml @@ -27,6 +27,7 @@ tokio = { version = "~1.35.1", features = [ tokio-stream = { version = "~0.1.6", features = ["net"] } tracing = "0.1" tracing-subscriber = "0.3" +pretty_assertions = "1.4.1" [dev-dependencies] criterion = { version = "0.4", features = ["html_reports"] } diff --git a/lykiadb-server/tests/planner/join b/lykiadb-server/tests/planner/join index 3fb2538b..110a40df 100644 --- a/lykiadb-server/tests/planner/join +++ b/lykiadb-server/tests/planner/join @@ -32,15 +32,21 @@ SELECT * FROM books b #[name=three_way_reordered, run=plan]> SELECT * FROM books b - INNER JOIN - (categories c ON b.category_id = c.id INNER JOIN publishers AS p ON b.publisher_id = p.id) + INNER JOIN + ( + categories c + INNER JOIN + publishers AS p + ON b.category_id = c.id + ) + ON b.publisher_id = p.id WHERE p.name = 'Springer'; --- - filter (p.name IsEqual Str("Springer")): - join [Inner, (b.publisher_id IsEqual p.id)]: + - scan [books as b] - join [Inner, (b.category_id IsEqual c.id)]: - scan [categories as c] - - scan [publishers as p] - - scan [books as b] \ No newline at end of file + - scan [publishers as p] \ No newline at end of file diff --git a/lykiadb-server/tests/util.rs b/lykiadb-server/tests/util.rs index 206f33d3..09be7917 100644 --- a/lykiadb-server/tests/util.rs +++ b/lykiadb-server/tests/util.rs @@ -1,5 +1,6 @@ use lykiadb_lang::{ast::stmt::Stmt, parser::program::Program}; use lykiadb_server::plan::planner::Planner; +use pretty_assertions::assert_eq; fn expect_plan(query: &str, expected_plan: &str) { let mut planner = Planner::new();