diff --git a/src/executor.rs b/src/executor.rs index c96bb4c4eaa5afb9e2e5212a555930e711c143d6..f7bf0d0b1f7080c29c210b9790f92344880e00a4 100644 --- a/src/executor.rs +++ b/src/executor.rs @@ -73,6 +73,12 @@ where /// # Errors /// - transformation can't be applied pub fn optimize(&mut self) -> Result<(), QueryPlannerError> { + self.plan.replace_in_operator()?; + self.plan.split_columns()?; + self.plan.set_dnf()?; + // TODO: make it a plan method and rename to "derive_equalities()". + self.plan.nodes.add_new_equalities()?; + self.plan.merge_tuples()?; self.plan.add_motions()?; Ok(()) } diff --git a/src/executor/tests.rs b/src/executor/tests.rs index e17dc90cd4a2c90427bfc78640411d6cee376ae4..772327c91cf27f9e6ca8674417bf8b93ba6af545 100644 --- a/src/executor/tests.rs +++ b/src/executor/tests.rs @@ -79,7 +79,7 @@ fn map_reduce_query() { "{} {} {}", r#"SELECT "hash_testing"."product_code" as "product_code""#, r#"FROM "hash_testing""#, - r#"WHERE ("hash_testing"."identification_number") = (1) and ("hash_testing"."product_code") = ('457')"#, + r#"WHERE ("hash_testing"."identification_number", "hash_testing"."product_code") = (1, '457')"#, ) ) ]); diff --git a/src/ir/transformation/bool_in.rs b/src/ir/transformation/bool_in.rs index 1339a75c2ad16850c9a08a41cb49d46cfb4737b6..411fe7386b173b743d0bc19456bf47f25f8840a7 100644 --- a/src/ir/transformation/bool_in.rs +++ b/src/ir/transformation/bool_in.rs @@ -42,6 +42,14 @@ impl Plan { ))); } }; + + // To not apply current transformation to motion and sub-query nodes. + if self.get_motion_from_row(right_id)?.is_some() + || self.get_sub_query_from_row_node(right_id)?.is_some() + { + return Ok(expr_id); + } + let right_columns = self.get_expression_node(right_id)?.extract_row_list()?; if let Some((first_id, other)) = right_columns.split_first() { let new_left_id = self.expr_clone(left_id)?;