diff --git a/src/binder/delete.rs b/src/binder/delete.rs index 6c570ed44..1a2c8b261 100644 --- a/src/binder/delete.rs +++ b/src/binder/delete.rs @@ -24,3 +24,30 @@ impl Binder { Ok(self.egraph.add(Node::Delete([table_id, filter]))) } } + +#[cfg(test)] +mod tests { + use std::sync::Arc; + + use super::*; + use crate::binder::Binder; + use crate::catalog::{ColumnCatalog, RootCatalog}; + use crate::parser::parse; + + #[test] + fn bind_test_subquery() { + let catalog = Arc::new(RootCatalog::new()); + let col_desc = DataTypeKind::Int32.not_null().to_column("a".into()); + let col_catalog = ColumnCatalog::new(0, col_desc); + catalog + .add_table(0, "t".into(), vec![col_catalog], false, vec![]) + .unwrap(); + + let stmts = parse("delete from t where a").unwrap(); + let mut binder = Binder::new(catalog); + for stmt in stmts { + let plan = binder.bind(stmt).unwrap(); + println!("{}", plan.pretty(10)); + } + } +} diff --git a/src/binder/drop.rs b/src/binder/drop.rs index 02368f194..5426c9970 100644 --- a/src/binder/drop.rs +++ b/src/binder/drop.rs @@ -84,6 +84,7 @@ impl Binder { mod tests { use std::sync::Arc; + use crate::binder::Binder; use crate::catalog::RootCatalog; use crate::parser::parse; @@ -95,6 +96,10 @@ mod tests { .unwrap(); let stmts = parse("drop table mytable").unwrap(); - println!("{:?}", stmts) + let mut binder = Binder::new(catalog); + for stmt in stmts { + let plan = binder.bind(stmt).unwrap(); + println!("{}", plan.pretty(10)); + } } }