From e947112e7ad803fd65f36301c1d53dbea5cd3c85 Mon Sep 17 00:00:00 2001
From: Igor Kuznetsov <kuznetsovin@gmail.com>
Date: Tue, 30 Aug 2022 12:17:39 +0300
Subject: [PATCH] feat: add unary operator test

---
 src/ir/explain/tests.rs | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

diff --git a/src/ir/explain/tests.rs b/src/ir/explain/tests.rs
index dea4ebe64f..152049aa9f 100644
--- a/src/ir/explain/tests.rs
+++ b/src/ir/explain/tests.rs
@@ -282,3 +282,23 @@ motion [policy: segment([ref("identification_number")]), generation: none]
 
     assert_eq!(actual_explain, explain_tree.to_string())
 }
+
+#[test]
+fn unary_condition_plan() {
+    let query = r#"SELECT "id", "FIRST_NAME" FROM "test_space" WHERE "id" IS NULL and "FIRST_NAME" IS NOT NULL"#;
+
+    let plan = sql_to_optimized_ir(query, vec![]);
+
+    let top = &plan.get_top().unwrap();
+    let explain_tree = FullExplain::new(&plan, *top).unwrap();
+
+    let mut actual_explain = String::new();
+    actual_explain.push_str(
+        r#"projection ("test_space"."id" -> "id", "test_space"."FIRST_NAME" -> "FIRST_NAME")
+    selection ROW("test_space"."FIRST_NAME") is not null and ROW("test_space"."id") is null
+        scan "test_space"
+"#,
+    );
+
+    assert_eq!(actual_explain, explain_tree.to_string())
+}
-- 
GitLab