From da94438e06d3b60b72509690880ff9a4012ca68e Mon Sep 17 00:00:00 2001 From: Rushmore Mushambi Date: Sun, 11 Feb 2024 18:48:22 +0200 Subject: [PATCH] Revert "Bugfix: Compute futures in query conditions" (#3476) --- core/src/doc/check.rs | 6 +----- core/src/doc/lives.rs | 3 +-- lib/tests/select.rs | 29 ----------------------------- 3 files changed, 2 insertions(+), 36 deletions(-) diff --git a/core/src/doc/check.rs b/core/src/doc/check.rs index e3e79b41..3a33f2c3 100644 --- a/core/src/doc/check.rs +++ b/core/src/doc/check.rs @@ -15,11 +15,7 @@ impl<'a> Document<'a> { // Check where condition if let Some(cond) = stm.conds() { // Check if the expression is truthy - if !cond - .compute(ctx, &opt.new_with_futures(true), txn, Some(&self.current)) - .await? - .is_truthy() - { + if !cond.compute(ctx, opt, txn, Some(&self.current)).await?.is_truthy() { // Ignore this document return Err(Error::Ignore); } diff --git a/core/src/doc/lives.rs b/core/src/doc/lives.rs index 2652a5d8..14d9a280 100644 --- a/core/src/doc/lives.rs +++ b/core/src/doc/lives.rs @@ -167,8 +167,7 @@ impl<'a> Document<'a> { // Check where condition if let Some(cond) = stm.conds() { // Check if the expression is truthy - - if !cond.compute(ctx, &opt.new_with_futures(true), txn, Some(doc)).await?.is_truthy() { + if !cond.compute(ctx, opt, txn, Some(doc)).await?.is_truthy() { // Ignore this document return Err(Error::Ignore); } diff --git a/lib/tests/select.rs b/lib/tests/select.rs index 51807213..fdfec2d6 100644 --- a/lib/tests/select.rs +++ b/lib/tests/select.rs @@ -1074,32 +1074,3 @@ async fn select_only() -> Result<(), Error> { // Ok(()) } - -#[tokio::test] -async fn select_on_future() -> Result<(), Error> { - let insert_query = " - CREATE person SET name = \"Hana\", age = 10, can_drive = { age > 17 }; - CREATE person SET name = \"Hendrick\", age = 18, can_drive = { age > 17 }; - "; - let dbs = new_ds().await?; - let ses = Session::owner().with_ns("test").with_db("test"); - dbs.execute(insert_query, &ses, None).await?; - - let select_query_true = " - SELECT name FROM person WHERE can_drive - "; - let mut res = dbs.execute(select_query_true, &ses, None).await?; - let tmp = res.remove(0).result?; - let val = Value::parse("[{ name: \"Hendrick\" }]"); - assert_eq!(tmp, val); - - let select_query_false = " - SELECT name FROM person WHERE !can_drive - "; - let mut res = dbs.execute(select_query_false, &ses, None).await?; - let tmp = res.remove(0).result?; - let val = Value::parse("[{ name: \"Hana\" }]"); - assert_eq!(tmp, val); - - Ok(()) -}