diff --git a/src/binder/create_table.rs b/src/binder/create_table.rs index 14756e64..54695b6e 100644 --- a/src/binder/create_table.rs +++ b/src/binder/create_table.rs @@ -188,16 +188,16 @@ mod tests { match plan1.operator { Operator::CreateTable(op) => { - debug_assert_eq!(op.table_name, Arc::new("t1".to_string())); - debug_assert_eq!(op.columns[0].name(), "id"); - debug_assert_eq!(op.columns[0].nullable(), false); - debug_assert_eq!( + assert_eq!(op.table_name, Arc::new("t1".to_string())); + assert_eq!(op.columns[0].name(), "id"); + assert_eq!(op.columns[0].nullable(), false); + assert_eq!( op.columns[0].desc(), &ColumnDesc::new(LogicalType::Integer, Some(0), false, None)? ); - debug_assert_eq!(op.columns[1].name(), "name"); - debug_assert_eq!(op.columns[1].nullable(), true); - debug_assert_eq!( + assert_eq!(op.columns[1].name(), "name"); + assert_eq!(op.columns[1].nullable(), true); + assert_eq!( op.columns[1].desc(), &ColumnDesc::new( LogicalType::Varchar(Some(10), CharLengthUnits::Characters), diff --git a/src/binder/mod.rs b/src/binder/mod.rs index ed6225bf..6c45ea9e 100644 --- a/src/binder/mod.rs +++ b/src/binder/mod.rs @@ -605,13 +605,13 @@ pub mod test { #[test] pub fn test_valid_identifier() { - debug_assert!(is_valid_identifier("valid_table")); - debug_assert!(is_valid_identifier("valid_column")); - debug_assert!(is_valid_identifier("_valid_column")); - debug_assert!(is_valid_identifier("valid_column_1")); - - debug_assert!(!is_valid_identifier("invalid_name&")); - debug_assert!(!is_valid_identifier("1_invalid_name")); - debug_assert!(!is_valid_identifier("____")); + assert!(is_valid_identifier("valid_table")); + assert!(is_valid_identifier("valid_column")); + assert!(is_valid_identifier("_valid_column")); + assert!(is_valid_identifier("valid_column_1")); + + assert!(!is_valid_identifier("invalid_name&")); + assert!(!is_valid_identifier("1_invalid_name")); + assert!(!is_valid_identifier("____")); } } diff --git a/src/catalog/table.rs b/src/catalog/table.rs index aaf76477..504f0a28 100644 --- a/src/catalog/table.rs +++ b/src/catalog/table.rs @@ -259,9 +259,9 @@ mod tests { let col_catalogs = vec![col0, col1]; let table_catalog = TableCatalog::new(Arc::new("test".to_string()), col_catalogs).unwrap(); - debug_assert_eq!(table_catalog.contains_column(&"a".to_string()), true); - debug_assert_eq!(table_catalog.contains_column(&"b".to_string()), true); - debug_assert_eq!(table_catalog.contains_column(&"c".to_string()), false); + assert_eq!(table_catalog.contains_column(&"a".to_string()), true); + assert_eq!(table_catalog.contains_column(&"b".to_string()), true); + assert_eq!(table_catalog.contains_column(&"c".to_string()), false); let col_a_id = table_catalog .get_column_id_by_name(&"a".to_string()) @@ -269,14 +269,14 @@ mod tests { let col_b_id = table_catalog .get_column_id_by_name(&"b".to_string()) .unwrap(); - debug_assert!(col_a_id < col_b_id); + assert!(col_a_id < col_b_id); let column_catalog = table_catalog.get_column_by_id(&col_a_id).unwrap(); - debug_assert_eq!(column_catalog.name(), "a"); - debug_assert_eq!(*column_catalog.datatype(), LogicalType::Integer,); + assert_eq!(column_catalog.name(), "a"); + assert_eq!(*column_catalog.datatype(), LogicalType::Integer,); let column_catalog = table_catalog.get_column_by_id(&col_b_id).unwrap(); - debug_assert_eq!(column_catalog.name(), "b"); - debug_assert_eq!(*column_catalog.datatype(), LogicalType::Boolean,); + assert_eq!(column_catalog.name(), "b"); + assert_eq!(*column_catalog.datatype(), LogicalType::Boolean,); } } diff --git a/src/db.rs b/src/db.rs index a3372e1b..fe224845 100644 --- a/src/db.rs +++ b/src/db.rs @@ -384,7 +384,7 @@ pub(crate) mod test { let (schema, tuples) = fnck_sql.run("select current_date()")?; println!("{}", create_table(&schema, &tuples)); - debug_assert_eq!( + assert_eq!( schema, Arc::new(vec![ColumnRef::from(ColumnCatalog::new( "current_date()".to_string(), @@ -392,7 +392,7 @@ pub(crate) mod test { ColumnDesc::new(LogicalType::Date, None, false, None).unwrap() ))]) ); - debug_assert_eq!( + assert_eq!( tuples, vec![Tuple { id: None, @@ -420,8 +420,8 @@ pub(crate) mod test { let number_column_id = schema[0].id().unwrap(); column.set_ref_table(Arc::new("a".to_string()), number_column_id, false); - debug_assert_eq!(schema, Arc::new(vec![ColumnRef::from(column)])); - debug_assert_eq!( + assert_eq!(schema, Arc::new(vec![ColumnRef::from(column)])); + assert_eq!( tuples, vec![ Tuple { @@ -456,34 +456,34 @@ pub(crate) mod test { let (_, tuples_1) = tx_1.run("select * from t1")?; let (_, tuples_2) = tx_2.run("select * from t1")?; - debug_assert_eq!(tuples_1.len(), 2); - debug_assert_eq!(tuples_2.len(), 2); + assert_eq!(tuples_1.len(), 2); + assert_eq!(tuples_2.len(), 2); - debug_assert_eq!( + assert_eq!( tuples_1[0].values, vec![DataValue::Int32(Some(0)), DataValue::Int32(Some(0))] ); - debug_assert_eq!( + assert_eq!( tuples_1[1].values, vec![DataValue::Int32(Some(1)), DataValue::Int32(Some(1))] ); - debug_assert_eq!( + assert_eq!( tuples_2[0].values, vec![DataValue::Int32(Some(0)), DataValue::Int32(Some(0))] ); - debug_assert_eq!( + assert_eq!( tuples_2[1].values, vec![DataValue::Int32(Some(3)), DataValue::Int32(Some(3))] ); tx_1.commit()?; - debug_assert!(tx_2.commit().is_err()); + assert!(tx_2.commit().is_err()); let mut tx_3 = fnck_sql.new_transaction()?; let res = tx_3.run("create table t2 (a int primary key, b int)"); - debug_assert!(res.is_err()); + assert!(res.is_err()); Ok(()) } diff --git a/src/execution/dml/copy_from_file.rs b/src/execution/dml/copy_from_file.rs index e65986de..b5fc68d7 100644 --- a/src/execution/dml/copy_from_file.rs +++ b/src/execution/dml/copy_from_file.rs @@ -210,7 +210,7 @@ mod tests { CoroutineState::Complete(()) => unreachable!(), } .unwrap(); - debug_assert_eq!( + assert_eq!( tuple, TupleBuilder::build_result(format!("import {} rows", 2)) ); diff --git a/src/execution/dql/aggregate/hash_agg.rs b/src/execution/dql/aggregate/hash_agg.rs index 803c4485..1918d7c7 100644 --- a/src/execution/dql/aggregate/hash_agg.rs +++ b/src/execution/dql/aggregate/hash_agg.rs @@ -253,12 +253,12 @@ mod test { ) ); - debug_assert_eq!(tuples.len(), 2); + assert_eq!(tuples.len(), 2); let vec_values = tuples.into_iter().map(|tuple| tuple.values).collect_vec(); - debug_assert!(vec_values.contains(&build_integers(vec![Some(3), Some(0)]))); - debug_assert!(vec_values.contains(&build_integers(vec![Some(5), Some(1)]))); + assert!(vec_values.contains(&build_integers(vec![Some(3), Some(0)]))); + assert!(vec_values.contains(&build_integers(vec![Some(5), Some(1)]))); Ok(()) } diff --git a/src/execution/dql/join/hash_join.rs b/src/execution/dql/join/hash_join.rs index 62ae7ca3..833dad64 100644 --- a/src/execution/dql/join/hash_join.rs +++ b/src/execution/dql/join/hash_join.rs @@ -543,17 +543,17 @@ mod test { .execute((&table_cache, &view_cache, &meta_cache), &transaction); let tuples = try_collect(executor)?; - debug_assert_eq!(tuples.len(), 3); + assert_eq!(tuples.len(), 3); - debug_assert_eq!( + assert_eq!( tuples[0].values, build_integers(vec![Some(0), Some(2), Some(4), Some(0), Some(2), Some(4)]) ); - debug_assert_eq!( + assert_eq!( tuples[1].values, build_integers(vec![Some(1), Some(3), Some(5), Some(1), Some(3), Some(5)]) ); - debug_assert_eq!( + assert_eq!( tuples[2].values, build_integers(vec![Some(1), Some(3), Some(5), Some(1), Some(1), Some(1)]) ); @@ -585,21 +585,21 @@ mod test { executor.execute((&table_cache, &view_cache, &meta_cache), &transaction), )?; - debug_assert_eq!(tuples.len(), 4); + assert_eq!(tuples.len(), 4); - debug_assert_eq!( + assert_eq!( tuples[0].values, build_integers(vec![Some(0), Some(2), Some(4), Some(0), Some(2), Some(4)]) ); - debug_assert_eq!( + assert_eq!( tuples[1].values, build_integers(vec![Some(1), Some(3), Some(5), Some(1), Some(3), Some(5)]) ); - debug_assert_eq!( + assert_eq!( tuples[2].values, build_integers(vec![Some(1), Some(3), Some(5), Some(1), Some(1), Some(1)]) ); - debug_assert_eq!( + assert_eq!( tuples[3].values, build_integers(vec![Some(3), Some(5), Some(7), None, None, None]) ); @@ -612,18 +612,18 @@ mod test { executor.execute((&table_cache, &view_cache, &meta_cache), &transaction), )?; - debug_assert_eq!(tuples.len(), 2); + assert_eq!(tuples.len(), 2); tuples.sort_by_key(|tuple| { let mut bytes = Vec::new(); tuple.values[0].memcomparable_encode(&mut bytes).unwrap(); bytes }); - debug_assert_eq!( + assert_eq!( tuples[0].values, build_integers(vec![Some(0), Some(2), Some(4)]) ); - debug_assert_eq!( + assert_eq!( tuples[1].values, build_integers(vec![Some(1), Some(3), Some(5)]) ); @@ -636,8 +636,8 @@ mod test { executor.execute((&table_cache, &view_cache, &meta_cache), &transaction), )?; - debug_assert_eq!(tuples.len(), 1); - debug_assert_eq!( + assert_eq!(tuples.len(), 1); + assert_eq!( tuples[0].values, build_integers(vec![Some(3), Some(5), Some(7)]) ); @@ -667,21 +667,21 @@ mod test { .execute((&table_cache, &view_cache, &meta_cache), &transaction); let tuples = try_collect(executor)?; - debug_assert_eq!(tuples.len(), 4); + assert_eq!(tuples.len(), 4); - debug_assert_eq!( + assert_eq!( tuples[0].values, build_integers(vec![Some(0), Some(2), Some(4), Some(0), Some(2), Some(4)]) ); - debug_assert_eq!( + assert_eq!( tuples[1].values, build_integers(vec![Some(1), Some(3), Some(5), Some(1), Some(3), Some(5)]) ); - debug_assert_eq!( + assert_eq!( tuples[2].values, build_integers(vec![None, None, None, Some(4), Some(6), Some(8)]) ); - debug_assert_eq!( + assert_eq!( tuples[3].values, build_integers(vec![Some(1), Some(3), Some(5), Some(1), Some(1), Some(1)]) ); @@ -710,25 +710,25 @@ mod test { .execute((&table_cache, &view_cache, &meta_cache), &transaction); let tuples = try_collect(executor)?; - debug_assert_eq!(tuples.len(), 5); + assert_eq!(tuples.len(), 5); - debug_assert_eq!( + assert_eq!( tuples[0].values, build_integers(vec![Some(0), Some(2), Some(4), Some(0), Some(2), Some(4)]) ); - debug_assert_eq!( + assert_eq!( tuples[1].values, build_integers(vec![Some(1), Some(3), Some(5), Some(1), Some(3), Some(5)]) ); - debug_assert_eq!( + assert_eq!( tuples[2].values, build_integers(vec![None, None, None, Some(4), Some(6), Some(8)]) ); - debug_assert_eq!( + assert_eq!( tuples[3].values, build_integers(vec![Some(1), Some(3), Some(5), Some(1), Some(1), Some(1)]) ); - debug_assert_eq!( + assert_eq!( tuples[4].values, build_integers(vec![Some(3), Some(5), Some(7), None, None, None]) ); diff --git a/src/execution/dql/join/nested_loop_join.rs b/src/execution/dql/join/nested_loop_join.rs index c88a1f22..508b3679 100644 --- a/src/execution/dql/join/nested_loop_join.rs +++ b/src/execution/dql/join/nested_loop_join.rs @@ -515,7 +515,7 @@ mod test { } fn valid_result(expected: &mut HashSet>, actual: &[Tuple]) { - debug_assert_eq!(actual.len(), expected.len()); + assert_eq!(actual.len(), expected.len()); for tuple in actual { let values = tuple @@ -529,10 +529,10 @@ mod test { } }) .collect_vec(); - debug_assert!(expected.remove(&values)); + assert!(expected.remove(&values)); } - debug_assert!(expected.is_empty()); + assert!(expected.is_empty()); } #[test] @@ -584,7 +584,7 @@ mod test { .execute((&table_cache, &view_cache, &meta_cache), &transaction); let tuples = try_collect(executor)?; - debug_assert_eq!( + assert_eq!( tuples[0].values, build_integers(vec![Some(0), Some(2), Some(4), None, None, None]) ); @@ -688,7 +688,7 @@ mod test { .execute((&table_cache, &view_cache, &meta_cache), &transaction); let tuples = try_collect(executor)?; - debug_assert_eq!(tuples.len(), 16); + assert_eq!(tuples.len(), 16); Ok(()) } @@ -806,7 +806,7 @@ mod test { .execute((&table_cache, &view_cache, &meta_cache), &transaction); let tuples = try_collect(executor)?; - debug_assert_eq!( + assert_eq!( tuples[0].values, build_integers(vec![Some(0), Some(2), Some(4), None, None, None]) ); diff --git a/src/execution/dql/sort.rs b/src/execution/dql/sort.rs index 176bc4f4..5e0b820c 100644 --- a/src/execution/dql/sort.rs +++ b/src/execution/dql/sort.rs @@ -289,7 +289,7 @@ mod test { (3, "abcd".as_bytes().to_vec()), ]; - debug_assert_eq!(radix_sort(indices), vec![0, 3, 2, 1]) + assert_eq!(radix_sort(indices), vec![0, 3, 2, 1]) } #[test] @@ -335,68 +335,68 @@ mod test { let fn_asc_and_nulls_last_eq = |mut iter: Box>| { if let Some(tuple) = iter.next() { - debug_assert_eq!(tuple.values, vec![DataValue::Int32(Some(0))]) + assert_eq!(tuple.values, vec![DataValue::Int32(Some(0))]) } else { unreachable!() } if let Some(tuple) = iter.next() { - debug_assert_eq!(tuple.values, vec![DataValue::Int32(Some(1))]) + assert_eq!(tuple.values, vec![DataValue::Int32(Some(1))]) } else { unreachable!() } if let Some(tuple) = iter.next() { - debug_assert_eq!(tuple.values, vec![DataValue::Int32(None)]) + assert_eq!(tuple.values, vec![DataValue::Int32(None)]) } else { unreachable!() } }; let fn_desc_and_nulls_last_eq = |mut iter: Box>| { if let Some(tuple) = iter.next() { - debug_assert_eq!(tuple.values, vec![DataValue::Int32(Some(1))]) + assert_eq!(tuple.values, vec![DataValue::Int32(Some(1))]) } else { unreachable!() } if let Some(tuple) = iter.next() { - debug_assert_eq!(tuple.values, vec![DataValue::Int32(Some(0))]) + assert_eq!(tuple.values, vec![DataValue::Int32(Some(0))]) } else { unreachable!() } if let Some(tuple) = iter.next() { - debug_assert_eq!(tuple.values, vec![DataValue::Int32(None)]) + assert_eq!(tuple.values, vec![DataValue::Int32(None)]) } else { unreachable!() } }; let fn_asc_and_nulls_first_eq = |mut iter: Box>| { if let Some(tuple) = iter.next() { - debug_assert_eq!(tuple.values, vec![DataValue::Int32(None)]) + assert_eq!(tuple.values, vec![DataValue::Int32(None)]) } else { unreachable!() } if let Some(tuple) = iter.next() { - debug_assert_eq!(tuple.values, vec![DataValue::Int32(Some(0))]) + assert_eq!(tuple.values, vec![DataValue::Int32(Some(0))]) } else { unreachable!() } if let Some(tuple) = iter.next() { - debug_assert_eq!(tuple.values, vec![DataValue::Int32(Some(1))]) + assert_eq!(tuple.values, vec![DataValue::Int32(Some(1))]) } else { unreachable!() } }; let fn_desc_and_nulls_first_eq = |mut iter: Box>| { if let Some(tuple) = iter.next() { - debug_assert_eq!(tuple.values, vec![DataValue::Int32(None)]) + assert_eq!(tuple.values, vec![DataValue::Int32(None)]) } else { unreachable!() } if let Some(tuple) = iter.next() { - debug_assert_eq!(tuple.values, vec![DataValue::Int32(Some(1))]) + assert_eq!(tuple.values, vec![DataValue::Int32(Some(1))]) } else { unreachable!() } if let Some(tuple) = iter.next() { - debug_assert_eq!(tuple.values, vec![DataValue::Int32(Some(0))]) + assert_eq!(tuple.values, vec![DataValue::Int32(Some(0))]) } else { unreachable!() } @@ -531,7 +531,7 @@ mod test { let fn_asc_1_and_nulls_first_1_and_asc_2_and_nulls_first_2_eq = |mut iter: Box>| { if let Some(tuple) = iter.next() { - debug_assert_eq!( + assert_eq!( tuple.values, vec![DataValue::Int32(None), DataValue::Int32(None)] ) @@ -539,7 +539,7 @@ mod test { unreachable!() } if let Some(tuple) = iter.next() { - debug_assert_eq!( + assert_eq!( tuple.values, vec![DataValue::Int32(None), DataValue::Int32(Some(0))] ) @@ -547,7 +547,7 @@ mod test { unreachable!() } if let Some(tuple) = iter.next() { - debug_assert_eq!( + assert_eq!( tuple.values, vec![DataValue::Int32(Some(0)), DataValue::Int32(None)] ) @@ -555,7 +555,7 @@ mod test { unreachable!() } if let Some(tuple) = iter.next() { - debug_assert_eq!( + assert_eq!( tuple.values, vec![DataValue::Int32(Some(0)), DataValue::Int32(Some(0))] ) @@ -563,7 +563,7 @@ mod test { unreachable!() } if let Some(tuple) = iter.next() { - debug_assert_eq!( + assert_eq!( tuple.values, vec![DataValue::Int32(Some(1)), DataValue::Int32(None)] ) @@ -571,7 +571,7 @@ mod test { unreachable!() } if let Some(tuple) = iter.next() { - debug_assert_eq!( + assert_eq!( tuple.values, vec![DataValue::Int32(Some(1)), DataValue::Int32(Some(0))] ) @@ -582,7 +582,7 @@ mod test { let fn_asc_1_and_nulls_last_1_and_asc_2_and_nulls_first_2_eq = |mut iter: Box>| { if let Some(tuple) = iter.next() { - debug_assert_eq!( + assert_eq!( tuple.values, vec![DataValue::Int32(Some(0)), DataValue::Int32(None)] ) @@ -590,7 +590,7 @@ mod test { unreachable!() } if let Some(tuple) = iter.next() { - debug_assert_eq!( + assert_eq!( tuple.values, vec![DataValue::Int32(Some(0)), DataValue::Int32(Some(0))] ) @@ -598,7 +598,7 @@ mod test { unreachable!() } if let Some(tuple) = iter.next() { - debug_assert_eq!( + assert_eq!( tuple.values, vec![DataValue::Int32(Some(1)), DataValue::Int32(None)] ) @@ -606,7 +606,7 @@ mod test { unreachable!() } if let Some(tuple) = iter.next() { - debug_assert_eq!( + assert_eq!( tuple.values, vec![DataValue::Int32(Some(1)), DataValue::Int32(Some(0))] ) @@ -614,7 +614,7 @@ mod test { unreachable!() } if let Some(tuple) = iter.next() { - debug_assert_eq!( + assert_eq!( tuple.values, vec![DataValue::Int32(None), DataValue::Int32(None)] ) @@ -622,7 +622,7 @@ mod test { unreachable!() } if let Some(tuple) = iter.next() { - debug_assert_eq!( + assert_eq!( tuple.values, vec![DataValue::Int32(None), DataValue::Int32(Some(0))] ) @@ -633,7 +633,7 @@ mod test { let fn_desc_1_and_nulls_first_1_and_asc_2_and_nulls_first_2_eq = |mut iter: Box>| { if let Some(tuple) = iter.next() { - debug_assert_eq!( + assert_eq!( tuple.values, vec![DataValue::Int32(None), DataValue::Int32(None)] ) @@ -641,7 +641,7 @@ mod test { unreachable!() } if let Some(tuple) = iter.next() { - debug_assert_eq!( + assert_eq!( tuple.values, vec![DataValue::Int32(None), DataValue::Int32(Some(0))] ) @@ -649,7 +649,7 @@ mod test { unreachable!() } if let Some(tuple) = iter.next() { - debug_assert_eq!( + assert_eq!( tuple.values, vec![DataValue::Int32(Some(1)), DataValue::Int32(None)] ) @@ -657,7 +657,7 @@ mod test { unreachable!() } if let Some(tuple) = iter.next() { - debug_assert_eq!( + assert_eq!( tuple.values, vec![DataValue::Int32(Some(1)), DataValue::Int32(Some(0))] ) @@ -665,7 +665,7 @@ mod test { unreachable!() } if let Some(tuple) = iter.next() { - debug_assert_eq!( + assert_eq!( tuple.values, vec![DataValue::Int32(Some(0)), DataValue::Int32(None)] ) @@ -673,7 +673,7 @@ mod test { unreachable!() } if let Some(tuple) = iter.next() { - debug_assert_eq!( + assert_eq!( tuple.values, vec![DataValue::Int32(Some(0)), DataValue::Int32(Some(0))] ) @@ -684,7 +684,7 @@ mod test { let fn_desc_1_and_nulls_last_1_and_asc_2_and_nulls_first_2_eq = |mut iter: Box>| { if let Some(tuple) = iter.next() { - debug_assert_eq!( + assert_eq!( tuple.values, vec![DataValue::Int32(Some(1)), DataValue::Int32(None)] ) @@ -692,7 +692,7 @@ mod test { unreachable!() } if let Some(tuple) = iter.next() { - debug_assert_eq!( + assert_eq!( tuple.values, vec![DataValue::Int32(Some(1)), DataValue::Int32(Some(0))] ) @@ -700,7 +700,7 @@ mod test { unreachable!() } if let Some(tuple) = iter.next() { - debug_assert_eq!( + assert_eq!( tuple.values, vec![DataValue::Int32(Some(0)), DataValue::Int32(None)] ) @@ -708,7 +708,7 @@ mod test { unreachable!() } if let Some(tuple) = iter.next() { - debug_assert_eq!( + assert_eq!( tuple.values, vec![DataValue::Int32(Some(0)), DataValue::Int32(Some(0))] ) @@ -716,7 +716,7 @@ mod test { unreachable!() } if let Some(tuple) = iter.next() { - debug_assert_eq!( + assert_eq!( tuple.values, vec![DataValue::Int32(None), DataValue::Int32(None)] ) @@ -724,7 +724,7 @@ mod test { unreachable!() } if let Some(tuple) = iter.next() { - debug_assert_eq!( + assert_eq!( tuple.values, vec![DataValue::Int32(None), DataValue::Int32(Some(0))] ) diff --git a/src/expression/range_detacher.rs b/src/expression/range_detacher.rs index ab45dee4..319447e7 100644 --- a/src/expression/range_detacher.rs +++ b/src/expression/range_detacher.rs @@ -823,7 +823,7 @@ mod test { .detach(&op.predicate) .unwrap(); println!("c1 = 1 => {}", range); - debug_assert_eq!(range, Range::Eq(DataValue::Int32(Some(1)))) + assert_eq!(range, Range::Eq(DataValue::Int32(Some(1)))) } { let plan = table_state.plan("select * from t1 where c1 != 1")?; @@ -831,7 +831,7 @@ mod test { let range = RangeDetacher::new("t1", table_state.column_id_by_name("c1")).detach(&op.predicate); println!("c1 != 1 => {:#?}", range); - debug_assert_eq!(range, None) + assert_eq!(range, None) } { let plan = table_state.plan("select * from t1 where c1 > 1")?; @@ -840,7 +840,7 @@ mod test { .detach(&op.predicate) .unwrap(); println!("c1 > 1 => c1: {}", range); - debug_assert_eq!( + assert_eq!( range, Range::Scope { min: Bound::Excluded(DataValue::Int32(Some(1))), @@ -855,7 +855,7 @@ mod test { .detach(&op.predicate) .unwrap(); println!("c1 >= 1 => c1: {}", range); - debug_assert_eq!( + assert_eq!( range, Range::Scope { min: Bound::Included(DataValue::Int32(Some(1))), @@ -870,7 +870,7 @@ mod test { .detach(&op.predicate) .unwrap(); println!("c1 < 1 => c1: {}", range); - debug_assert_eq!( + assert_eq!( range, Range::Scope { min: Bound::Unbounded, @@ -885,7 +885,7 @@ mod test { .detach(&op.predicate) .unwrap(); println!("c1 <= 1 => c1: {}", range); - debug_assert_eq!( + assert_eq!( range, Range::Scope { min: Bound::Unbounded, @@ -900,7 +900,7 @@ mod test { .detach(&op.predicate) .unwrap(); println!("c1 < 1 and c1 >= 0 => c1: {}", range); - debug_assert_eq!( + assert_eq!( range, Range::Scope { min: Bound::Included(DataValue::Int32(Some(0))), @@ -915,7 +915,7 @@ mod test { .detach(&op.predicate) .unwrap(); println!("c1 < 1 or c1 >= 0 => c1: {}", range); - debug_assert_eq!( + assert_eq!( range, Range::Scope { min: Bound::Unbounded, @@ -931,7 +931,7 @@ mod test { .detach(&op.predicate) .unwrap(); println!("c1 = 1 and c1 = 0 => c1: {}", range); - debug_assert_eq!(range, Range::Dummy) + assert_eq!(range, Range::Dummy) } { let plan = table_state.plan("select * from t1 where c1 = 1 or c1 = 0")?; @@ -940,7 +940,7 @@ mod test { .detach(&op.predicate) .unwrap(); println!("c1 = 1 or c1 = 0 => c1: {}", range); - debug_assert_eq!( + assert_eq!( range, Range::SortedRanges(vec![ Range::Eq(DataValue::Int32(Some(0))), @@ -955,7 +955,7 @@ mod test { .detach(&op.predicate) .unwrap(); println!("c1 = 1 and c1 = 1 => c1: {}", range); - debug_assert_eq!(range, Range::Eq(DataValue::Int32(Some(1)))) + assert_eq!(range, Range::Eq(DataValue::Int32(Some(1)))) } { let plan = table_state.plan("select * from t1 where c1 = 1 or c1 = 1")?; @@ -964,7 +964,7 @@ mod test { .detach(&op.predicate) .unwrap(); println!("c1 = 1 or c1 = 1 => c1: {}", range); - debug_assert_eq!(range, Range::Eq(DataValue::Int32(Some(1)))) + assert_eq!(range, Range::Eq(DataValue::Int32(Some(1)))) } { @@ -974,7 +974,7 @@ mod test { .detach(&op.predicate) .unwrap(); println!("c1 > 1 and c1 = 1 => c1: {}", range); - debug_assert_eq!(range, Range::Dummy) + assert_eq!(range, Range::Dummy) } { let plan = table_state.plan("select * from t1 where c1 >= 1 and c1 = 1")?; @@ -983,7 +983,7 @@ mod test { .detach(&op.predicate) .unwrap(); println!("c1 >= 1 and c1 = 1 => c1: {}", range); - debug_assert_eq!(range, Range::Eq(DataValue::Int32(Some(1)))) + assert_eq!(range, Range::Eq(DataValue::Int32(Some(1)))) } { let plan = table_state.plan("select * from t1 where c1 > 1 or c1 = 1")?; @@ -992,7 +992,7 @@ mod test { .detach(&op.predicate) .unwrap(); println!("c1 > 1 or c1 = 1 => c1: {}", range); - debug_assert_eq!( + assert_eq!( range, Range::Scope { min: Bound::Included(DataValue::Int32(Some(1))), @@ -1007,7 +1007,7 @@ mod test { .detach(&op.predicate) .unwrap(); println!("c1 >= 1 or c1 = 1 => c1: {}", range); - debug_assert_eq!( + assert_eq!( range, Range::Scope { min: Bound::Included(DataValue::Int32(Some(1))), @@ -1027,7 +1027,7 @@ mod test { "(c1 > 0 and c1 < 3) and (c1 > 1 and c1 < 4) => c1: {}", range ); - debug_assert_eq!( + assert_eq!( range, Range::Scope { min: Bound::Excluded(DataValue::Int32(Some(1))), @@ -1046,7 +1046,7 @@ mod test { "(c1 > 0 and c1 < 3) or (c1 > 1 and c1 < 4) => c1: {}", range ); - debug_assert_eq!( + assert_eq!( range, Range::Scope { min: Bound::Excluded(DataValue::Int32(Some(0))), @@ -1067,7 +1067,7 @@ mod test { "((c1 > 0 and c1 < 3) and (c1 > 1 and c1 < 4)) and c1 = 0 => c1: {}", range ); - debug_assert_eq!(range, Range::Dummy) + assert_eq!(range, Range::Dummy) } { let plan = table_state.plan( @@ -1081,7 +1081,7 @@ mod test { "((c1 > 0 and c1 < 3) or (c1 > 1 and c1 < 4)) and c1 = 0 => c1: {}", range ); - debug_assert_eq!(range, Range::Dummy) + assert_eq!(range, Range::Dummy) } { let plan = table_state.plan( @@ -1095,7 +1095,7 @@ mod test { "((c1 > 0 and c1 < 3) and (c1 > 1 and c1 < 4)) or c1 = 0 => c1: {}", range ); - debug_assert_eq!( + assert_eq!( range, Range::SortedRanges(vec![ Range::Eq(DataValue::Int32(Some(0))), @@ -1118,7 +1118,7 @@ mod test { "((c1 > 0 and c1 < 3) or (c1 > 1 and c1 < 4)) or c1 = 0 => c1: {}", range ); - debug_assert_eq!( + assert_eq!( range, Range::Scope { min: Bound::Included(DataValue::Int32(Some(0))), @@ -1134,7 +1134,7 @@ mod test { .detach(&op.predicate) .unwrap(); println!("(((c1 > 0 and c1 < 3) and (c1 > 1 and c1 < 4)) and c1 = 0) and (c1 >= 0 and c1 <= 2) => c1: {}", range); - debug_assert_eq!(range, Range::Dummy) + assert_eq!(range, Range::Dummy) } { let plan = table_state.plan("select * from t1 where (((c1 > 0 and c1 < 3) and (c1 > 1 and c1 < 4)) and c1 = 0) or (c1 >= 0 and c1 <= 2)")?; @@ -1143,7 +1143,7 @@ mod test { .detach(&op.predicate) .unwrap(); println!("(((c1 > 0 and c1 < 3) and (c1 > 1 and c1 < 4)) and c1 = 0) or (c1 >= 0 and c1 <= 2) => c1: {}", range); - debug_assert_eq!( + assert_eq!( range, Range::Scope { min: Bound::Included(DataValue::Int32(Some(0))), @@ -1159,7 +1159,7 @@ mod test { .detach(&op.predicate) .unwrap(); println!("((c1 < 2 and c1 > 0) or (c1 < 6 and c1 > 4)) and ((c1 < 3 and c1 > 1) or (c1 < 7 and c1 > 5)) => c1: {}", range); - debug_assert_eq!( + assert_eq!( range, Range::SortedRanges(vec![ Range::Scope { @@ -1180,7 +1180,7 @@ mod test { .detach(&op.predicate) .unwrap(); println!("((c1 < 2 and c1 > 0) or (c1 < 6 and c1 > 4)) or ((c1 < 3 and c1 > 1) or (c1 < 7 and c1 > 5)) => c1: {}", range); - debug_assert_eq!( + assert_eq!( range, Range::SortedRanges(vec![ Range::Scope { @@ -1201,7 +1201,7 @@ mod test { let range = RangeDetacher::new("t1", table_state.column_id_by_name("c1")).detach(&op.predicate); println!("empty => c1: {:#?}", range); - debug_assert_eq!(range, None) + assert_eq!(range, None) } // other column { @@ -1210,7 +1210,7 @@ mod test { let range = RangeDetacher::new("t1", table_state.column_id_by_name("c1")).detach(&op.predicate); println!("c2 = 1 => c1: {:#?}", range); - debug_assert_eq!(range, None) + assert_eq!(range, None) } { let plan = table_state.plan("select * from t1 where c1 > 1 or c2 > 1")?; @@ -1218,7 +1218,7 @@ mod test { let range = RangeDetacher::new("t1", table_state.column_id_by_name("c1")).detach(&op.predicate); println!("c1 > 1 or c2 > 1 => c1: {:#?}", range); - debug_assert_eq!(range, None) + assert_eq!(range, None) } { let plan = table_state.plan("select * from t1 where c1 > c2 or c2 > 1")?; @@ -1226,7 +1226,7 @@ mod test { let range = RangeDetacher::new("t1", table_state.column_id_by_name("c1")).detach(&op.predicate); println!("c1 > c2 or c2 > 1 => c1: {:#?}", range); - debug_assert_eq!(range, None) + assert_eq!(range, None) } // case 1 { @@ -1241,7 +1241,7 @@ mod test { "c1 = 5 or (c1 > 5 and (c1 > 6 or c1 < 8) and c1 < 12) => c1: {}", range ); - debug_assert_eq!( + assert_eq!( range, Range::Scope { min: Bound::Included(DataValue::Int32(Some(5))), @@ -1262,7 +1262,7 @@ mod test { "((c2 >= -8 and -4 >= c1) or (c1 >= 0 and 5 > c2)) and ((c2 > 0 and c1 <= 1) or (c1 > -8 and c2 < -6)) => c1: {}", range ); - debug_assert_eq!( + assert_eq!( range, Range::SortedRanges(vec![ Range::Scope { @@ -1292,7 +1292,7 @@ mod test { .detach(&op.predicate) .unwrap(); println!("c1 = null => c1: {}", range); - debug_assert_eq!(range, Range::Eq(DataValue::Int32(None))) + assert_eq!(range, Range::Eq(DataValue::Int32(None))) } { let plan = table_state.plan("select * from t1 where c1 = null or c1 = 1")?; @@ -1301,7 +1301,7 @@ mod test { .detach(&op.predicate) .unwrap(); println!("c1 = null or c1 = 1 => c1: {}", range); - debug_assert_eq!( + assert_eq!( range, Range::SortedRanges(vec![ Range::Eq(DataValue::Int32(None)), @@ -1316,7 +1316,7 @@ mod test { .detach(&op.predicate) .unwrap(); println!("c1 = null or c1 < 5 => c1: {}", range); - debug_assert_eq!( + assert_eq!( range, Range::Scope { min: Bound::Unbounded, @@ -1332,7 +1332,7 @@ mod test { .detach(&op.predicate) .unwrap(); println!("c1 = null or (c1 > 1 and c1 < 5) => c1: {}", range); - debug_assert_eq!( + assert_eq!( range, Range::SortedRanges(vec![ Range::Eq(DataValue::Int32(None)), @@ -1350,7 +1350,7 @@ mod test { .detach(&op.predicate) .unwrap(); println!("c1 = null and c1 < 5 => c1: {}", range); - debug_assert_eq!(range, Range::Eq(DataValue::Int32(None))) + assert_eq!(range, Range::Eq(DataValue::Int32(None))) } { let plan = @@ -1360,7 +1360,7 @@ mod test { .detach(&op.predicate) .unwrap(); println!("c1 = null and (c1 > 1 and c1 < 5) => c1: {}", range); - debug_assert_eq!(range, Range::Dummy) + assert_eq!(range, Range::Dummy) } // noteq { @@ -1369,7 +1369,7 @@ mod test { let range = RangeDetacher::new("t1", table_state.column_id_by_name("c1")).detach(&op.predicate); println!("c1 != null => c1: {:#?}", range); - debug_assert_eq!(range, None) + assert_eq!(range, None) } { let plan = table_state.plan("select * from t1 where c1 = null or c1 != 1")?; @@ -1377,7 +1377,7 @@ mod test { let range = RangeDetacher::new("t1", table_state.column_id_by_name("c1")).detach(&op.predicate); println!("c1 = null or c1 != 1 => c1: {:#?}", range); - debug_assert_eq!(range, None) + assert_eq!(range, None) } { let plan = table_state.plan("select * from t1 where c1 != null or c1 < 5")?; @@ -1385,7 +1385,7 @@ mod test { let range = RangeDetacher::new("t1", table_state.column_id_by_name("c1")).detach(&op.predicate); println!("c1 != null or c1 < 5 => c1: {:#?}", range); - debug_assert_eq!(range, None) + assert_eq!(range, None) } { let plan = @@ -1394,7 +1394,7 @@ mod test { let range = RangeDetacher::new("t1", table_state.column_id_by_name("c1")).detach(&op.predicate); println!("c1 != null or (c1 > 1 and c1 < 5) => c1: {:#?}", range); - debug_assert_eq!(range, None) + assert_eq!(range, None) } { let plan = table_state.plan("select * from t1 where c1 != null and c1 < 5")?; @@ -1403,7 +1403,7 @@ mod test { .detach(&op.predicate) .unwrap(); println!("c1 != null and c1 < 5 => c1: {}", range); - debug_assert_eq!( + assert_eq!( range, Range::Scope { min: Bound::Unbounded, @@ -1419,7 +1419,7 @@ mod test { .detach(&op.predicate) .unwrap(); println!("c1 != null and (c1 > 1 and c1 < 5) => c1: {}", range); - debug_assert_eq!( + assert_eq!( range, Range::Scope { min: Bound::Excluded(DataValue::Int32(Some(1))), @@ -1434,7 +1434,7 @@ mod test { .detach(&op.predicate) .unwrap(); println!("(c1 = null or (c1 < 2 and c1 > 0) or (c1 < 6 and c1 > 4)) or ((c1 < 3 and c1 > 1) or (c1 < 7 and c1 > 5)) => c1: {}", range); - debug_assert_eq!( + assert_eq!( range, Range::SortedRanges(vec![ Range::Eq(DataValue::Int32(None)), @@ -1456,7 +1456,7 @@ mod test { .detach(&op.predicate) .unwrap(); println!("((c1 < 2 and c1 > 0) or (c1 < 6 and c1 > 4)) or (c1 = null or (c1 < 3 and c1 > 1) or (c1 < 7 and c1 > 5)) => c1: {}", range); - debug_assert_eq!( + assert_eq!( range, Range::SortedRanges(vec![ Range::Eq(DataValue::Int32(None)), @@ -1478,7 +1478,7 @@ mod test { .detach(&op.predicate) .unwrap(); println!("(c1 = null or (c1 < 2 and c1 > 0) or (c1 < 6 and c1 > 4)) and ((c1 < 3 and c1 > 1) or (c1 < 7 and c1 > 5)) => c1: {}", range); - debug_assert_eq!( + assert_eq!( range, Range::SortedRanges(vec![ Range::Scope { @@ -1499,7 +1499,7 @@ mod test { .detach(&op.predicate) .unwrap(); println!("((c1 < 2 and c1 > 0) or (c1 < 6 and c1 > 4)) and (c1 = null or (c1 < 3 and c1 > 1) or (c1 < 7 and c1 > 5)) => c1: {}", range); - debug_assert_eq!( + assert_eq!( range, Range::SortedRanges(vec![ Range::Scope { @@ -1538,7 +1538,7 @@ mod test { } .combining_eqs(&eqs_ranges); - debug_assert_eq!( + assert_eq!( range, Some(Range::Scope { min: Bound::Included(DataValue::Tuple(Some(vec![ @@ -1557,7 +1557,7 @@ mod test { } .combining_eqs(&eqs_ranges); - debug_assert_eq!( + assert_eq!( range, Some(Range::Scope { min: Bound::Unbounded, @@ -1576,7 +1576,7 @@ mod test { } .combining_eqs(&eqs_ranges); - debug_assert_eq!( + assert_eq!( range, Some(Range::SortedRanges(vec![ Range::Scope { @@ -1698,7 +1698,7 @@ mod test { } .combining_eqs(&eqs_ranges_2); - debug_assert_eq!(range_1, None); - debug_assert_eq!(range_2, None); + assert_eq!(range_1, None); + assert_eq!(range_2, None); } } diff --git a/src/optimizer/core/cm_sketch.rs b/src/optimizer/core/cm_sketch.rs index 054bcfa1..bb009b31 100644 --- a/src/optimizer/core/cm_sketch.rs +++ b/src/optimizer/core/cm_sketch.rs @@ -212,7 +212,7 @@ mod tests { for _ in 0..300 { cms.increment("key"); } - debug_assert_eq!(cms.estimate("key"), 300); + assert_eq!(cms.estimate("key"), 300); } #[test] @@ -222,7 +222,7 @@ mod tests { cms.increment(&(i % 100)); } for key in 0..100 { - debug_assert!(cms.estimate(&key) >= 9_000); + assert!(cms.estimate(&key) >= 9_000); } } @@ -232,7 +232,7 @@ mod tests { for _ in 0..300 { cms.increment(&DataValue::Int32(Some(300))); } - debug_assert_eq!( + assert_eq!( cms.collect_count(&vec![ Range::Eq(DataValue::Int32(Some(300))), Range::Scope { diff --git a/src/optimizer/core/histogram.rs b/src/optimizer/core/histogram.rs index ca3062ca..05f830a6 100644 --- a/src/optimizer/core/histogram.rs +++ b/src/optimizer/core/histogram.rs @@ -504,14 +504,14 @@ mod tests { builder.append(&DataValue::Null)?; builder.append(&DataValue::Int32(None))?; - // debug_assert!(matches!(builder.build(10), Err(DataBaseError::TooManyBuckets))); + // assert!(matches!(builder.build(10), Err(DataBaseError::TooManyBuckets))); let (histogram, _) = builder.build(5)?; - debug_assert_eq!(histogram.correlation, 1.0); - debug_assert_eq!(histogram.null_count, 2); - debug_assert_eq!(histogram.buckets.len(), 5); - debug_assert_eq!( + assert_eq!(histogram.correlation, 1.0); + assert_eq!(histogram.null_count, 2); + assert_eq!(histogram.buckets.len(), 5); + assert_eq!( histogram.buckets, vec![ Bucket { @@ -572,10 +572,10 @@ mod tests { let (histogram, _) = builder.build(5)?; - debug_assert_eq!(histogram.correlation, -1.0); - debug_assert_eq!(histogram.null_count, 2); - debug_assert_eq!(histogram.buckets.len(), 5); - debug_assert_eq!( + assert_eq!(histogram.correlation, -1.0); + assert_eq!(histogram.null_count, 2); + assert_eq!(histogram.buckets.len(), 5); + assert_eq!( histogram.buckets, vec![ Bucket { @@ -636,10 +636,10 @@ mod tests { let (histogram, _) = builder.build(4)?; - debug_assert!(histogram.correlation < 0.0); - debug_assert_eq!(histogram.null_count, 2); - debug_assert_eq!(histogram.buckets.len(), 4); - debug_assert_eq!( + assert!(histogram.correlation < 0.0); + assert_eq!(histogram.null_count, 2); + assert_eq!(histogram.buckets.len(), 4); + assert_eq!( histogram.buckets, vec![ Bucket { @@ -706,7 +706,7 @@ mod tests { &sketch, )?; - debug_assert_eq!(count_1, 9); + assert_eq!(count_1, 9); let count_2 = histogram.collect_count( &vec![Range::Scope { @@ -716,7 +716,7 @@ mod tests { &sketch, )?; - debug_assert_eq!(count_2, 11); + assert_eq!(count_2, 11); let count_3 = histogram.collect_count( &vec![Range::Scope { @@ -726,7 +726,7 @@ mod tests { &sketch, )?; - debug_assert_eq!(count_3, 7); + assert_eq!(count_3, 7); let count_4 = histogram.collect_count( &vec![Range::Scope { @@ -736,7 +736,7 @@ mod tests { &sketch, )?; - debug_assert_eq!(count_4, 12); + assert_eq!(count_4, 12); let count_5 = histogram.collect_count( &vec![Range::Scope { @@ -746,7 +746,7 @@ mod tests { &sketch, )?; - debug_assert_eq!(count_5, 8); + assert_eq!(count_5, 8); let count_6 = histogram.collect_count( &vec![Range::Scope { @@ -756,7 +756,7 @@ mod tests { &sketch, )?; - debug_assert_eq!(count_6, 13); + assert_eq!(count_6, 13); let count_7 = histogram.collect_count( &vec![Range::Scope { @@ -766,7 +766,7 @@ mod tests { &sketch, )?; - debug_assert_eq!(count_7, 13); + assert_eq!(count_7, 13); let count_8 = histogram.collect_count( &vec![Range::Scope { @@ -776,7 +776,7 @@ mod tests { &sketch, )?; - debug_assert_eq!(count_8, 13); + assert_eq!(count_8, 13); let count_9 = histogram.collect_count( &vec![Range::Scope { @@ -786,7 +786,7 @@ mod tests { &sketch, )?; - debug_assert_eq!(count_9, 13); + assert_eq!(count_9, 13); let count_10 = histogram.collect_count( &vec![Range::Scope { @@ -796,7 +796,7 @@ mod tests { &sketch, )?; - debug_assert_eq!(count_10, 2); + assert_eq!(count_10, 2); let count_11 = histogram.collect_count( &vec![Range::Scope { @@ -806,7 +806,7 @@ mod tests { &sketch, )?; - debug_assert_eq!(count_11, 2); + assert_eq!(count_11, 2); Ok(()) } diff --git a/src/optimizer/core/memo.rs b/src/optimizer/core/memo.rs index e1fe8202..36321169 100644 --- a/src/optimizer/core/memo.rs +++ b/src/optimizer/core/memo.rs @@ -173,12 +173,12 @@ mod tests { let best_plan = graph.into_plan(Some(&memo)); let exprs = &memo.groups.get(&NodeIndex::new(3)).unwrap(); - debug_assert_eq!(exprs.exprs.len(), 2); - debug_assert_eq!(exprs.exprs[0].cost, Some(1000)); - debug_assert_eq!(exprs.exprs[0].op, PhysicalOption::SeqScan); - debug_assert!(exprs.exprs[1].cost.unwrap() >= 960); - debug_assert!(matches!(exprs.exprs[1].op, PhysicalOption::IndexScan(_))); - debug_assert_eq!( + assert_eq!(exprs.exprs.len(), 2); + assert_eq!(exprs.exprs[0].cost, Some(1000)); + assert_eq!(exprs.exprs[0].op, PhysicalOption::SeqScan); + assert!(exprs.exprs[1].cost.unwrap() >= 960); + assert!(matches!(exprs.exprs[1].op, PhysicalOption::IndexScan(_))); + assert_eq!( best_plan.as_ref().unwrap().childrens[0].childrens[0].childrens[0].physical_option, Some(PhysicalOption::IndexScan(IndexInfo { meta: Arc::new(IndexMeta { diff --git a/src/optimizer/core/statistics_meta.rs b/src/optimizer/core/statistics_meta.rs index b266ce12..e46f5173 100644 --- a/src/optimizer/core/statistics_meta.rs +++ b/src/optimizer/core/statistics_meta.rs @@ -156,8 +156,8 @@ mod tests { StatisticsMeta::new(histogram.clone(), sketch.clone()).to_file(path.clone())?; let statistics_meta = StatisticsMeta::from_file::(path)?; - debug_assert_eq!(histogram, statistics_meta.histogram); - debug_assert_eq!( + assert_eq!(histogram, statistics_meta.histogram); + assert_eq!( sketch.estimate(&DataValue::Null), statistics_meta.cm_sketch.estimate(&DataValue::Null) ); diff --git a/src/optimizer/heuristic/graph.rs b/src/optimizer/heuristic/graph.rs index 862fd5dc..047e9c0f 100644 --- a/src/optimizer/heuristic/graph.rs +++ b/src/optimizer/heuristic/graph.rs @@ -227,19 +227,19 @@ mod tests { let plan = table_state.plan("select * from t1 left join t2 on c1 = c3")?; let graph = HepGraph::new(plan); - debug_assert!(graph + assert!(graph .graph .contains_edge(NodeIndex::new(1), NodeIndex::new(2))); - debug_assert!(graph + assert!(graph .graph .contains_edge(NodeIndex::new(1), NodeIndex::new(3))); - debug_assert!(graph + assert!(graph .graph .contains_edge(NodeIndex::new(0), NodeIndex::new(1))); - debug_assert_eq!(graph.graph.edge_weight(EdgeIndex::new(0)), Some(&0)); - debug_assert_eq!(graph.graph.edge_weight(EdgeIndex::new(1)), Some(&1)); - debug_assert_eq!(graph.graph.edge_weight(EdgeIndex::new(2)), Some(&0)); + assert_eq!(graph.graph.edge_weight(EdgeIndex::new(0)), Some(&0)); + assert_eq!(graph.graph.edge_weight(EdgeIndex::new(1)), Some(&1)); + assert_eq!(graph.graph.edge_weight(EdgeIndex::new(2)), Some(&0)); Ok(()) } @@ -256,19 +256,19 @@ mod tests { graph.add_node(HepNodeId::new(5), None, Operator::Dummy); - debug_assert!(graph + assert!(graph .graph .contains_edge(NodeIndex::new(5), NodeIndex::new(4))); - debug_assert!(graph + assert!(graph .graph .contains_edge(NodeIndex::new(1), NodeIndex::new(5))); - debug_assert!(graph + assert!(graph .graph .contains_edge(NodeIndex::new(5), NodeIndex::new(6))); - debug_assert_eq!(graph.graph.edge_weight(EdgeIndex::new(3)), Some(&0)); - debug_assert_eq!(graph.graph.edge_weight(EdgeIndex::new(4)), Some(&2)); - debug_assert_eq!(graph.graph.edge_weight(EdgeIndex::new(5)), Some(&1)); + assert_eq!(graph.graph.edge_weight(EdgeIndex::new(3)), Some(&0)); + assert_eq!(graph.graph.edge_weight(EdgeIndex::new(4)), Some(&2)); + assert_eq!(graph.graph.edge_weight(EdgeIndex::new(5)), Some(&1)); Ok(()) } @@ -281,7 +281,7 @@ mod tests { graph.replace_node(HepNodeId::new(1), Operator::Dummy); - debug_assert!(matches!(graph.operator(HepNodeId::new(1)), Operator::Dummy)); + assert!(matches!(graph.operator(HepNodeId::new(1)), Operator::Dummy)); Ok(()) } @@ -294,12 +294,12 @@ mod tests { graph.remove_node(HepNodeId::new(1), false); - debug_assert_eq!(graph.graph.edge_count(), 2); + assert_eq!(graph.graph.edge_count(), 2); - debug_assert!(graph + assert!(graph .graph .contains_edge(NodeIndex::new(0), NodeIndex::new(2))); - debug_assert!(graph + assert!(graph .graph .contains_edge(NodeIndex::new(0), NodeIndex::new(3))); @@ -314,7 +314,7 @@ mod tests { graph.remove_node(HepNodeId::new(1), true); - debug_assert_eq!(graph.graph.edge_count(), 0); + assert_eq!(graph.graph.edge_count(), 0); Ok(()) } @@ -333,8 +333,8 @@ mod tests { let op_0 = graph.operator(HepNodeId::new(0)); let op_1 = graph.operator(HepNodeId::new(1)); - debug_assert_eq!(op_0, &before_op_1); - debug_assert_eq!(op_1, &before_op_0); + assert_eq!(op_0, &before_op_1); + assert_eq!(op_1, &before_op_0); Ok(()) } @@ -347,11 +347,11 @@ mod tests { graph.add_root(Operator::Dummy); - debug_assert_eq!(graph.graph.edge_count(), 4); - debug_assert!(graph + assert_eq!(graph.graph.edge_count(), 4); + assert!(graph .graph .contains_edge(NodeIndex::new(4), NodeIndex::new(0))); - debug_assert_eq!(graph.graph.edge_weight(EdgeIndex::new(3)), Some(&0)); + assert_eq!(graph.graph.edge_weight(EdgeIndex::new(3)), Some(&0)); Ok(()) } @@ -374,7 +374,7 @@ mod tests { let plan_for_graph = graph.into_plan(None).unwrap(); - debug_assert_eq!(plan, plan_for_graph); + assert_eq!(plan, plan_for_graph); Ok(()) } diff --git a/src/optimizer/heuristic/matcher.rs b/src/optimizer/heuristic/matcher.rs index 10e0531c..57de0023 100644 --- a/src/optimizer/heuristic/matcher.rs +++ b/src/optimizer/heuristic/matcher.rs @@ -85,7 +85,7 @@ mod tests { }]), }; - debug_assert!( + assert!( HepMatcher::new(&project_into_table_scan_pattern, HepNodeId::new(0), &graph) .match_opt_expr() ); @@ -129,8 +129,6 @@ mod tests { children: PatternChildrenPredicate::Recursive, }; - debug_assert!( - HepMatcher::new(&only_dummy_pattern, HepNodeId::new(0), &graph).match_opt_expr() - ); + assert!(HepMatcher::new(&only_dummy_pattern, HepNodeId::new(0), &graph).match_opt_expr()); } } diff --git a/src/optimizer/rule/normalization/column_pruning.rs b/src/optimizer/rule/normalization/column_pruning.rs index 4ee89992..0dddba5c 100644 --- a/src/optimizer/rule/normalization/column_pruning.rs +++ b/src/optimizer/rule/normalization/column_pruning.rs @@ -211,30 +211,30 @@ mod tests { ) .find_best::(None)?; - debug_assert_eq!(best_plan.childrens.len(), 1); + assert_eq!(best_plan.childrens.len(), 1); match best_plan.operator { Operator::Project(op) => { - debug_assert_eq!(op.exprs.len(), 2); + assert_eq!(op.exprs.len(), 2); } _ => unreachable!("Should be a project operator"), } match &best_plan.childrens[0].operator { Operator::Join(op) => match &op.on { JoinCondition::On { on, filter } => { - debug_assert_eq!(on.len(), 1); - debug_assert!(filter.is_none()); + assert_eq!(on.len(), 1); + assert!(filter.is_none()); } _ => unreachable!("Should be a on condition"), }, _ => unreachable!("Should be a join operator"), } - debug_assert_eq!(best_plan.childrens[0].childrens.len(), 2); + assert_eq!(best_plan.childrens[0].childrens.len(), 2); for grandson_plan in &best_plan.childrens[0].childrens { match &grandson_plan.operator { Operator::TableScan(op) => { - debug_assert_eq!(op.columns.len(), 1); + assert_eq!(op.columns.len(), 1); } _ => unreachable!("Should be a scan operator"), } diff --git a/src/optimizer/rule/normalization/combine_operators.rs b/src/optimizer/rule/normalization/combine_operators.rs index d8eb775f..c89e1436 100644 --- a/src/optimizer/rule/normalization/combine_operators.rs +++ b/src/optimizer/rule/normalization/combine_operators.rs @@ -176,13 +176,13 @@ mod tests { let best_plan = optimizer.find_best::(None)?; if let Operator::Project(op) = &best_plan.operator { - debug_assert_eq!(op.exprs.len(), 1); + assert_eq!(op.exprs.len(), 1); } else { unreachable!("Should be a project operator") } if let Operator::TableScan(_) = &best_plan.childrens[0].operator { - debug_assert_eq!(best_plan.childrens[0].childrens.len(), 0) + assert_eq!(best_plan.childrens[0].childrens.len(), 0) } else { unreachable!("Should be a scan operator") } @@ -223,7 +223,7 @@ mod tests { if let Operator::Filter(op) = &best_plan.childrens[0].operator { if let ScalarExpression::Binary { op, .. } = &op.predicate { - debug_assert_eq!(op, &BinaryOperator::And); + assert_eq!(op, &BinaryOperator::And); } else { unreachable!("Should be a and operator") } diff --git a/src/optimizer/rule/normalization/pushdown_limit.rs b/src/optimizer/rule/normalization/pushdown_limit.rs index 9f6ef1e9..07f01e84 100644 --- a/src/optimizer/rule/normalization/pushdown_limit.rs +++ b/src/optimizer/rule/normalization/pushdown_limit.rs @@ -180,7 +180,7 @@ mod tests { } if let Operator::Limit(op) = &best_plan.childrens[0].childrens[0].childrens[0].operator { - debug_assert_eq!(op.limit, Some(1)); + assert_eq!(op.limit, Some(1)); } else { unreachable!("Should be a limit operator") } @@ -205,7 +205,7 @@ mod tests { .find_best::(None)?; if let Operator::TableScan(op) = &best_plan.childrens[0].operator { - debug_assert_eq!(op.limit, (Some(1), Some(1))) + assert_eq!(op.limit, (Some(1), Some(1))) } else { unreachable!("Should be a project operator") } diff --git a/src/optimizer/rule/normalization/pushdown_predicates.rs b/src/optimizer/rule/normalization/pushdown_predicates.rs index 2fab7acb..a3ae7fe6 100644 --- a/src/optimizer/rule/normalization/pushdown_predicates.rs +++ b/src/optimizer/rule/normalization/pushdown_predicates.rs @@ -312,7 +312,7 @@ mod tests { max: Bound::Unbounded, }; - debug_assert_eq!(op.index_infos[0].range, Some(mock_range)); + assert_eq!(op.index_infos[0].range, Some(mock_range)); } else { unreachable!("Should be a filter operator") } diff --git a/src/optimizer/rule/normalization/simplification.rs b/src/optimizer/rule/normalization/simplification.rs index ed9470bb..227f75ff 100644 --- a/src/optimizer/rule/normalization/simplification.rs +++ b/src/optimizer/rule/normalization/simplification.rs @@ -143,11 +143,11 @@ mod test { if let Operator::Project(project_op) = best_plan.clone().operator { let constant_expr = ScalarExpression::Constant(DataValue::Int32(Some(3))); if let ScalarExpression::Binary { right_expr, .. } = &project_op.exprs[0] { - debug_assert_eq!(right_expr.as_ref(), &constant_expr); + assert_eq!(right_expr.as_ref(), &constant_expr); } else { unreachable!(); } - debug_assert_eq!(&project_op.exprs[1], &constant_expr); + assert_eq!(&project_op.exprs[1], &constant_expr); } else { unreachable!(); } @@ -155,7 +155,7 @@ mod test { let range = RangeDetacher::new("t1", table_state.column_id_by_name("c1")) .detach(&filter_op.predicate) .unwrap(); - debug_assert_eq!( + assert_eq!( range, Range::Scope { min: Bound::Unbounded, @@ -218,17 +218,17 @@ mod test { let op_4 = op(plan_4)?; let op_5 = op(plan_9)?; - debug_assert!(op_1.is_some()); - debug_assert!(op_2.is_some()); - debug_assert!(op_3.is_some()); - debug_assert!(op_4.is_some()); - debug_assert!(op_5.is_some()); + assert!(op_1.is_some()); + assert!(op_2.is_some()); + assert!(op_3.is_some()); + assert!(op_4.is_some()); + assert!(op_5.is_some()); - debug_assert_eq!(op_1, op(plan_5)?); - debug_assert_eq!(op_2, op(plan_6)?); - debug_assert_eq!(op_3, op(plan_7)?); - debug_assert_eq!(op_4, op(plan_8)?); - debug_assert_eq!(op_5, op(plan_10)?); + assert_eq!(op_1, op(plan_5)?); + assert_eq!(op_2, op(plan_6)?); + assert_eq!(op_3, op(plan_7)?); + assert_eq!(op_4, op(plan_8)?); + assert_eq!(op_5, op(plan_10)?); Ok(()) } @@ -274,7 +274,7 @@ mod test { ); // -(c1 + 1) > c2 => c1 < -c2 - 1 - debug_assert_eq!( + assert_eq!( filter_op.predicate, ScalarExpression::Binary { op: BinaryOperator::Gt, @@ -348,56 +348,56 @@ mod test { let range_4_c1 = plan_filter(&plan_4, table_state.column_id_by_name("c1"))?.unwrap(); let range_4_c2 = plan_filter(&plan_4, table_state.column_id_by_name("c2"))?.unwrap(); - debug_assert_eq!( + assert_eq!( range_1_c1, Range::Scope { min: Bound::Unbounded, max: Bound::Excluded(DataValue::Int32(Some(-2))) } ); - debug_assert_eq!( + assert_eq!( range_1_c2, Range::Scope { min: Bound::Excluded(DataValue::Int32(Some(2))), max: Bound::Unbounded } ); - debug_assert_eq!( + assert_eq!( range_2_c1, Range::Scope { min: Bound::Excluded(DataValue::Int32(Some(2))), max: Bound::Unbounded } ); - debug_assert_eq!( + assert_eq!( range_2_c2, Range::Scope { min: Bound::Unbounded, max: Bound::Excluded(DataValue::Int32(Some(-2))) } ); - debug_assert_eq!( + assert_eq!( range_3_c1, Range::Scope { min: Bound::Unbounded, max: Bound::Excluded(DataValue::Int32(Some(-1))) } ); - debug_assert_eq!( + assert_eq!( range_3_c2, Range::Scope { min: Bound::Excluded(DataValue::Int32(Some(0))), max: Bound::Unbounded } ); - debug_assert_eq!( + assert_eq!( range_4_c1, Range::Scope { min: Bound::Excluded(DataValue::Int32(Some(0))), max: Bound::Unbounded } ); - debug_assert_eq!( + assert_eq!( range_4_c2, Range::Scope { min: Bound::Unbounded, @@ -414,7 +414,7 @@ mod test { // c1 > c2 or c1 > 1 let plan_1 = table_state.plan("select * from t1 where c1 > c2 or c1 > 1")?; - debug_assert_eq!( + assert_eq!( plan_filter(&plan_1, table_state.column_id_by_name("c1"))?, None ); @@ -427,7 +427,7 @@ mod test { let table_state = build_t1_table()?; let plan_1 = table_state.plan("select * from t1 where c1 = 4 and c1 > c2 or c1 > 1")?; - debug_assert_eq!( + assert_eq!( plan_filter(&plan_1, table_state.column_id_by_name("c1"))?, Some(Range::Scope { min: Bound::Excluded(DataValue::Int32(Some(1))), @@ -443,7 +443,7 @@ mod test { let table_state = build_t1_table()?; let plan_1 = table_state.plan("select * from t1 where c1 is null")?; - debug_assert_eq!( + assert_eq!( plan_filter(&plan_1, table_state.column_id_by_name("c1"))?, Some(Range::Eq(DataValue::Null)) ); @@ -456,7 +456,7 @@ mod test { let table_state = build_t1_table()?; let plan_1 = table_state.plan("select * from t1 where c1 is not null")?; - debug_assert_eq!( + assert_eq!( plan_filter(&plan_1, table_state.column_id_by_name("c1"))?, None ); @@ -469,7 +469,7 @@ mod test { let table_state = build_t1_table()?; let plan_1 = table_state.plan("select * from t1 where c1 in (1, 2, 3)")?; - debug_assert_eq!( + assert_eq!( plan_filter(&plan_1, table_state.column_id_by_name("c1"))?, Some(Range::SortedRanges(vec![ Range::Eq(DataValue::Int32(Some(1))), @@ -486,7 +486,7 @@ mod test { let table_state = build_t1_table()?; let plan_1 = table_state.plan("select * from t1 where c1 not in (1, 2, 3)")?; - debug_assert_eq!( + assert_eq!( plan_filter(&plan_1, table_state.column_id_by_name("c1"))?, None ); diff --git a/src/storage/rocksdb.rs b/src/storage/rocksdb.rs index 85648ae0..8d606a90 100644 --- a/src/storage/rocksdb.rs +++ b/src/storage/rocksdb.rs @@ -182,8 +182,8 @@ mod test { )?; let table_catalog = transaction.table(&table_cache, Arc::new("test".to_string()))?; - debug_assert!(table_catalog.is_some()); - debug_assert!(table_catalog + assert!(table_catalog.is_some()); + assert!(table_catalog .unwrap() .get_column_id_by_name(&"c1".to_string()) .is_some()); @@ -215,10 +215,10 @@ mod test { )?; let option_1 = iter.next_tuple()?; - debug_assert_eq!(option_1.unwrap().id, Some(DataValue::Int32(Some(2)))); + assert_eq!(option_1.unwrap().id, Some(DataValue::Int32(Some(2)))); let option_2 = iter.next_tuple()?; - debug_assert_eq!(option_2, None); + assert_eq!(option_2, None); Ok(()) } @@ -280,7 +280,7 @@ mod test { result.push(tuple.id.unwrap()); } - debug_assert_eq!(result, tuple_ids); + assert_eq!(result, tuple_ids); Ok(()) } @@ -313,8 +313,8 @@ mod test { .unwrap(); while let Some(tuple) = iter.next_tuple()? { - debug_assert_eq!(tuple.id, Some(DataValue::Int32(Some(1)))); - debug_assert_eq!( + assert_eq!(tuple.id, Some(DataValue::Int32(Some(1)))); + assert_eq!( tuple.values, vec![DataValue::Int32(Some(1)), DataValue::Int32(Some(1))] ) diff --git a/src/storage/table_codec.rs b/src/storage/table_codec.rs index 83b7ff13..a05f268d 100644 --- a/src/storage/table_codec.rs +++ b/src/storage/table_codec.rs @@ -544,7 +544,7 @@ mod tests { let schema = table_catalog.schema_ref(); let mut id_builder = TupleIdBuilder::new(schema); - debug_assert_eq!( + assert_eq!( TableCodec::decode_tuple( &table_catalog.types(), &mut id_builder, @@ -568,7 +568,7 @@ mod tests { let table_meta = TableCodec::decode_root_table::(&bytes).unwrap(); - debug_assert_eq!(table_meta.table_name.as_str(), table_catalog.name.as_str()); + assert_eq!(table_meta.table_name.as_str(), table_catalog.name.as_str()); } #[test] @@ -577,7 +577,7 @@ mod tests { let (_, bytes) = TableCodec::encode_statistics_path("t1", 0, path.clone()); let decode_path = TableCodec::decode_statistics_path(&bytes).unwrap(); - debug_assert_eq!(path, decode_path); + assert_eq!(path, decode_path); } #[test] @@ -592,7 +592,7 @@ mod tests { }; let (_, bytes) = TableCodec::encode_index_meta(&"T1".to_string(), &index_meta)?; - debug_assert_eq!( + assert_eq!( TableCodec::decode_index_meta::(&bytes)?, index_meta ); @@ -612,7 +612,7 @@ mod tests { let tuple_id = DataValue::Int32(Some(0)); let (_, bytes) = TableCodec::encode_index(&table_catalog.name, &index, &tuple_id)?; - debug_assert_eq!( + assert_eq!( TableCodec::decode_index(&bytes, &tuple_id.logical_type())?, tuple_id ); @@ -641,7 +641,7 @@ mod tests { let decode_col = TableCodec::decode_column::(&mut cursor, &reference_tables)?; - debug_assert_eq!(decode_col, col); + assert_eq!(decode_col, col); Ok(()) } @@ -661,7 +661,7 @@ mod tests { let (_, bytes) = TableCodec::encode_view(&view)?; let transaction = table_state.storage.transaction()?; - debug_assert_eq!( + assert_eq!( view, TableCodec::decode_view(&bytes, (&transaction, &table_state.table_cache))? ); @@ -676,7 +676,7 @@ mod tests { let (_, bytes) = TableCodec::encode_view(&view)?; let transaction = table_state.storage.transaction()?; - debug_assert_eq!( + assert_eq!( view, TableCodec::decode_view(&bytes, (&transaction, &table_state.table_cache))? ); @@ -691,7 +691,7 @@ mod tests { let (_, bytes) = TableCodec::encode_view(&view)?; let transaction = table_state.storage.transaction()?; - debug_assert_eq!( + assert_eq!( view, TableCodec::decode_view(&bytes, (&transaction, &table_state.table_cache))? ); @@ -743,11 +743,11 @@ mod tests { )) .collect_vec(); - debug_assert_eq!(vec.len(), 3); + assert_eq!(vec.len(), 3); - debug_assert_eq!(vec[0], &op(0, "T1")); - debug_assert_eq!(vec[1], &op(1, "T1")); - debug_assert_eq!(vec[2], &op(2, "T1")); + assert_eq!(vec[0], &op(0, "T1")); + assert_eq!(vec[1], &op(1, "T1")); + assert_eq!(vec[2], &op(2, "T1")); } #[test] @@ -789,11 +789,11 @@ mod tests { )) .collect_vec(); - debug_assert_eq!(vec.len(), 3); + assert_eq!(vec.len(), 3); - debug_assert_eq!(vec[0], &op(0, "T1")); - debug_assert_eq!(vec[1], &op(1, "T1")); - debug_assert_eq!(vec[2], &op(2, "T1")); + assert_eq!(vec[0], &op(0, "T1")); + assert_eq!(vec[1], &op(1, "T1")); + assert_eq!(vec[2], &op(2, "T1")); } #[test] @@ -843,17 +843,17 @@ mod tests { )) .collect_vec(); - debug_assert_eq!(vec.len(), 3); + assert_eq!(vec.len(), 3); - debug_assert_eq!( + assert_eq!( vec[0], &op(DataValue::Int32(Some(0)), 1, &table_catalog.name) ); - debug_assert_eq!( + assert_eq!( vec[1], &op(DataValue::Int32(Some(1)), 1, &table_catalog.name) ); - debug_assert_eq!( + assert_eq!( vec[2], &op(DataValue::Int32(Some(2)), 1, &table_catalog.name) ); @@ -894,11 +894,11 @@ mod tests { )) .collect_vec(); - debug_assert_eq!(vec.len(), 3); + assert_eq!(vec.len(), 3); - debug_assert_eq!(vec[0], &op(DataValue::Int32(Some(0)), 0, "T1")); - debug_assert_eq!(vec[1], &op(DataValue::Int32(Some(1)), 0, "T1")); - debug_assert_eq!(vec[2], &op(DataValue::Int32(Some(2)), 0, "T1")); + assert_eq!(vec[0], &op(DataValue::Int32(Some(0)), 0, "T1")); + assert_eq!(vec[1], &op(DataValue::Int32(Some(1)), 0, "T1")); + assert_eq!(vec[2], &op(DataValue::Int32(Some(2)), 0, "T1")); } #[test] @@ -929,11 +929,11 @@ mod tests { )) .collect_vec(); - debug_assert_eq!(vec.len(), 3); + assert_eq!(vec.len(), 3); - debug_assert_eq!(vec[0], &op(DataValue::Int32(Some(0)), "T1")); - debug_assert_eq!(vec[1], &op(DataValue::Int32(Some(1)), "T1")); - debug_assert_eq!(vec[2], &op(DataValue::Int32(Some(2)), "T1")); + assert_eq!(vec[0], &op(DataValue::Int32(Some(0)), "T1")); + assert_eq!(vec[1], &op(DataValue::Int32(Some(1)), "T1")); + assert_eq!(vec[2], &op(DataValue::Int32(Some(2)), "T1")); } #[test] @@ -958,9 +958,9 @@ mod tests { )) .collect_vec(); - debug_assert_eq!(vec[0], &op("T0")); - debug_assert_eq!(vec[1], &op("T1")); - debug_assert_eq!(vec[2], &op("T2")); + assert_eq!(vec[0], &op("T0")); + assert_eq!(vec[1], &op("T1")); + assert_eq!(vec[2], &op("T2")); } #[test] @@ -985,8 +985,8 @@ mod tests { )) .collect_vec(); - debug_assert_eq!(vec[0], &op("V0")); - debug_assert_eq!(vec[1], &op("V1")); - debug_assert_eq!(vec[2], &op("V2")); + assert_eq!(vec[0], &op("V0")); + assert_eq!(vec[1], &op("V1")); + assert_eq!(vec[2], &op("V2")); } } diff --git a/src/types/evaluator/mod.rs b/src/types/evaluator/mod.rs index 933ac317..ef0f6411 100644 --- a/src/types/evaluator/mod.rs +++ b/src/types/evaluator/mod.rs @@ -567,9 +567,9 @@ mod test { .0 .binary_eval(&DataValue::Int32(Some(1)), &DataValue::Int32(Some(1))); - debug_assert_eq!(plus_i32_1, plus_i32_2); - debug_assert_eq!(plus_i32_2, plus_i32_3); - debug_assert_eq!(plus_i32_4, DataValue::Int32(Some(2))); + assert_eq!(plus_i32_1, plus_i32_2); + assert_eq!(plus_i32_2, plus_i32_3); + assert_eq!(plus_i32_4, DataValue::Int32(Some(2))); let plus_evaluator = EvaluatorFactory::binary_create(LogicalType::Bigint, BinaryOperator::Plus)?; @@ -586,9 +586,9 @@ mod test { .0 .binary_eval(&DataValue::Int64(Some(1)), &DataValue::Int64(Some(1))); - debug_assert_eq!(plus_i64_1, plus_i64_2); - debug_assert_eq!(plus_i64_2, plus_i64_3); - debug_assert_eq!(plus_i64_4, DataValue::Int64(Some(2))); + assert_eq!(plus_i64_1, plus_i64_2); + assert_eq!(plus_i64_2, plus_i64_3); + assert_eq!(plus_i64_4, DataValue::Int64(Some(2))); let plus_evaluator = EvaluatorFactory::binary_create(LogicalType::Double, BinaryOperator::Plus)?; @@ -606,9 +606,9 @@ mod test { &DataValue::Float64(Some(1.0)), ); - debug_assert_eq!(plus_f64_1, plus_f64_2); - debug_assert_eq!(plus_f64_2, plus_f64_3); - debug_assert_eq!(plus_f64_4, DataValue::Float64(Some(2.0))); + assert_eq!(plus_f64_1, plus_f64_2); + assert_eq!(plus_f64_2, plus_f64_3); + assert_eq!(plus_f64_4, DataValue::Float64(Some(2.0))); Ok(()) } @@ -630,9 +630,9 @@ mod test { .0 .binary_eval(&DataValue::Int32(Some(1)), &DataValue::Int32(Some(1))); - debug_assert_eq!(minus_i32_1, minus_i32_2); - debug_assert_eq!(minus_i32_2, minus_i32_3); - debug_assert_eq!(minus_i32_4, DataValue::Int32(Some(0))); + assert_eq!(minus_i32_1, minus_i32_2); + assert_eq!(minus_i32_2, minus_i32_3); + assert_eq!(minus_i32_4, DataValue::Int32(Some(0))); let minus_evaluator = EvaluatorFactory::binary_create(LogicalType::Bigint, BinaryOperator::Minus)?; @@ -649,9 +649,9 @@ mod test { .0 .binary_eval(&DataValue::Int64(Some(1)), &DataValue::Int64(Some(1))); - debug_assert_eq!(minus_i64_1, minus_i64_2); - debug_assert_eq!(minus_i64_2, minus_i64_3); - debug_assert_eq!(minus_i64_4, DataValue::Int64(Some(0))); + assert_eq!(minus_i64_1, minus_i64_2); + assert_eq!(minus_i64_2, minus_i64_3); + assert_eq!(minus_i64_4, DataValue::Int64(Some(0))); let minus_evaluator = EvaluatorFactory::binary_create(LogicalType::Double, BinaryOperator::Minus)?; @@ -669,9 +669,9 @@ mod test { &DataValue::Float64(Some(1.0)), ); - debug_assert_eq!(minus_f64_1, minus_f64_2); - debug_assert_eq!(minus_f64_2, minus_f64_3); - debug_assert_eq!(minus_f64_4, DataValue::Float64(Some(0.0))); + assert_eq!(minus_f64_1, minus_f64_2); + assert_eq!(minus_f64_2, minus_f64_3); + assert_eq!(minus_f64_4, DataValue::Float64(Some(0.0))); Ok(()) } @@ -693,9 +693,9 @@ mod test { .0 .binary_eval(&DataValue::Int32(Some(1)), &DataValue::Int32(Some(1))); - debug_assert_eq!(multiply_i32_1, multiply_i32_2); - debug_assert_eq!(multiply_i32_2, multiply_i32_3); - debug_assert_eq!(multiply_i32_4, DataValue::Int32(Some(1))); + assert_eq!(multiply_i32_1, multiply_i32_2); + assert_eq!(multiply_i32_2, multiply_i32_3); + assert_eq!(multiply_i32_4, DataValue::Int32(Some(1))); let multiply_evaluator = EvaluatorFactory::binary_create(LogicalType::Bigint, BinaryOperator::Multiply)?; @@ -712,9 +712,9 @@ mod test { .0 .binary_eval(&DataValue::Int64(Some(1)), &DataValue::Int64(Some(1))); - debug_assert_eq!(multiply_i64_1, multiply_i64_2); - debug_assert_eq!(multiply_i64_2, multiply_i64_3); - debug_assert_eq!(multiply_i64_4, DataValue::Int64(Some(1))); + assert_eq!(multiply_i64_1, multiply_i64_2); + assert_eq!(multiply_i64_2, multiply_i64_3); + assert_eq!(multiply_i64_4, DataValue::Int64(Some(1))); let multiply_evaluator = EvaluatorFactory::binary_create(LogicalType::Double, BinaryOperator::Multiply)?; @@ -732,9 +732,9 @@ mod test { &DataValue::Float64(Some(1.0)), ); - debug_assert_eq!(multiply_f64_1, multiply_f64_2); - debug_assert_eq!(multiply_f64_2, multiply_f64_3); - debug_assert_eq!(multiply_f64_4, DataValue::Float64(Some(1.0))); + assert_eq!(multiply_f64_1, multiply_f64_2); + assert_eq!(multiply_f64_2, multiply_f64_3); + assert_eq!(multiply_f64_4, DataValue::Float64(Some(1.0))); Ok(()) } @@ -756,9 +756,9 @@ mod test { .0 .binary_eval(&DataValue::Int32(Some(1)), &DataValue::Int32(Some(1))); - debug_assert_eq!(divide_i32_1, divide_i32_2); - debug_assert_eq!(divide_i32_2, divide_i32_3); - debug_assert_eq!(divide_i32_4, DataValue::Float64(Some(1.0))); + assert_eq!(divide_i32_1, divide_i32_2); + assert_eq!(divide_i32_2, divide_i32_3); + assert_eq!(divide_i32_4, DataValue::Float64(Some(1.0))); let divide_evaluator = EvaluatorFactory::binary_create(LogicalType::Bigint, BinaryOperator::Divide)?; @@ -775,9 +775,9 @@ mod test { .0 .binary_eval(&DataValue::Int64(Some(1)), &DataValue::Int64(Some(1))); - debug_assert_eq!(divide_i64_1, divide_i64_2); - debug_assert_eq!(divide_i64_2, divide_i64_3); - debug_assert_eq!(divide_i64_4, DataValue::Float64(Some(1.0))); + assert_eq!(divide_i64_1, divide_i64_2); + assert_eq!(divide_i64_2, divide_i64_3); + assert_eq!(divide_i64_4, DataValue::Float64(Some(1.0))); let divide_evaluator = EvaluatorFactory::binary_create(LogicalType::Double, BinaryOperator::Divide)?; @@ -795,9 +795,9 @@ mod test { &DataValue::Float64(Some(1.0)), ); - debug_assert_eq!(divide_f64_1, divide_f64_2); - debug_assert_eq!(divide_f64_2, divide_f64_3); - debug_assert_eq!(divide_f64_4, DataValue::Float64(Some(1.0))); + assert_eq!(divide_f64_1, divide_f64_2); + assert_eq!(divide_f64_2, divide_f64_3); + assert_eq!(divide_f64_4, DataValue::Float64(Some(1.0))); Ok(()) } @@ -805,14 +805,14 @@ mod test { #[test] fn test_binary_op_i32_compare() -> Result<(), DatabaseError> { let evaluator = EvaluatorFactory::binary_create(LogicalType::Integer, BinaryOperator::Gt)?; - debug_assert_eq!( + assert_eq!( evaluator .0 .binary_eval(&DataValue::Int32(Some(1)), &DataValue::Int32(Some(0)),), DataValue::Boolean(Some(true)) ); let evaluator = EvaluatorFactory::binary_create(LogicalType::Integer, BinaryOperator::Lt)?; - debug_assert_eq!( + assert_eq!( evaluator .0 .binary_eval(&DataValue::Int32(Some(1)), &DataValue::Int32(Some(0)),), @@ -820,7 +820,7 @@ mod test { ); let evaluator = EvaluatorFactory::binary_create(LogicalType::Integer, BinaryOperator::GtEq)?; - debug_assert_eq!( + assert_eq!( evaluator .0 .binary_eval(&DataValue::Int32(Some(1)), &DataValue::Int32(Some(1)),), @@ -828,7 +828,7 @@ mod test { ); let evaluator = EvaluatorFactory::binary_create(LogicalType::Integer, BinaryOperator::LtEq)?; - debug_assert_eq!( + assert_eq!( evaluator .0 .binary_eval(&DataValue::Int32(Some(1)), &DataValue::Int32(Some(1)),), @@ -836,28 +836,28 @@ mod test { ); let evaluator = EvaluatorFactory::binary_create(LogicalType::Integer, BinaryOperator::NotEq)?; - debug_assert_eq!( + assert_eq!( evaluator .0 .binary_eval(&DataValue::Int32(Some(1)), &DataValue::Int32(Some(1)),), DataValue::Boolean(Some(false)) ); let evaluator = EvaluatorFactory::binary_create(LogicalType::Integer, BinaryOperator::Eq)?; - debug_assert_eq!( + assert_eq!( evaluator .0 .binary_eval(&DataValue::Int32(Some(1)), &DataValue::Int32(Some(1)),), DataValue::Boolean(Some(true)) ); let evaluator = EvaluatorFactory::binary_create(LogicalType::Integer, BinaryOperator::Gt)?; - debug_assert_eq!( + assert_eq!( evaluator .0 .binary_eval(&DataValue::Int32(None), &DataValue::Int32(Some(0)),), DataValue::Boolean(None) ); let evaluator = EvaluatorFactory::binary_create(LogicalType::Integer, BinaryOperator::Lt)?; - debug_assert_eq!( + assert_eq!( evaluator .0 .binary_eval(&DataValue::Int32(None), &DataValue::Int32(Some(0)),), @@ -865,7 +865,7 @@ mod test { ); let evaluator = EvaluatorFactory::binary_create(LogicalType::Integer, BinaryOperator::GtEq)?; - debug_assert_eq!( + assert_eq!( evaluator .0 .binary_eval(&DataValue::Int32(None), &DataValue::Int32(Some(1)),), @@ -873,7 +873,7 @@ mod test { ); let evaluator = EvaluatorFactory::binary_create(LogicalType::Integer, BinaryOperator::LtEq)?; - debug_assert_eq!( + assert_eq!( evaluator .0 .binary_eval(&DataValue::Int32(None), &DataValue::Int32(Some(1)),), @@ -881,21 +881,21 @@ mod test { ); let evaluator = EvaluatorFactory::binary_create(LogicalType::Integer, BinaryOperator::NotEq)?; - debug_assert_eq!( + assert_eq!( evaluator .0 .binary_eval(&DataValue::Int32(None), &DataValue::Int32(Some(1)),), DataValue::Boolean(None) ); let evaluator = EvaluatorFactory::binary_create(LogicalType::Integer, BinaryOperator::Eq)?; - debug_assert_eq!( + assert_eq!( evaluator .0 .binary_eval(&DataValue::Int32(None), &DataValue::Int32(Some(1)),), DataValue::Boolean(None) ); let evaluator = EvaluatorFactory::binary_create(LogicalType::Integer, BinaryOperator::Eq)?; - debug_assert_eq!( + assert_eq!( evaluator .0 .binary_eval(&DataValue::Int32(None), &DataValue::Int32(None),), @@ -908,56 +908,56 @@ mod test { #[test] fn test_binary_op_bool_compare() -> Result<(), DatabaseError> { let evaluator = EvaluatorFactory::binary_create(LogicalType::Boolean, BinaryOperator::And)?; - debug_assert_eq!( + assert_eq!( evaluator.0.binary_eval( &DataValue::Boolean(Some(true)), &DataValue::Boolean(Some(true)), ), DataValue::Boolean(Some(true)) ); - debug_assert_eq!( + assert_eq!( evaluator.0.binary_eval( &DataValue::Boolean(Some(false)), &DataValue::Boolean(Some(true)), ), DataValue::Boolean(Some(false)) ); - debug_assert_eq!( + assert_eq!( evaluator.0.binary_eval( &DataValue::Boolean(Some(false)), &DataValue::Boolean(Some(false)), ), DataValue::Boolean(Some(false)) ); - debug_assert_eq!( + assert_eq!( evaluator .0 .binary_eval(&DataValue::Boolean(None), &DataValue::Boolean(Some(true)),), DataValue::Boolean(None) ); let evaluator = EvaluatorFactory::binary_create(LogicalType::Boolean, BinaryOperator::Or)?; - debug_assert_eq!( + assert_eq!( evaluator.0.binary_eval( &DataValue::Boolean(Some(true)), &DataValue::Boolean(Some(true)), ), DataValue::Boolean(Some(true)) ); - debug_assert_eq!( + assert_eq!( evaluator.0.binary_eval( &DataValue::Boolean(Some(false)), &DataValue::Boolean(Some(true)), ), DataValue::Boolean(Some(true)) ); - debug_assert_eq!( + assert_eq!( evaluator.0.binary_eval( &DataValue::Boolean(Some(false)), &DataValue::Boolean(Some(false)), ), DataValue::Boolean(Some(false)) ); - debug_assert_eq!( + assert_eq!( evaluator .0 .binary_eval(&DataValue::Boolean(None), &DataValue::Boolean(Some(true)),), @@ -973,7 +973,7 @@ mod test { LogicalType::Varchar(None, CharLengthUnits::Characters), BinaryOperator::Gt, )?; - debug_assert_eq!( + assert_eq!( evaluator.0.binary_eval( &DataValue::Utf8 { value: Some("a".to_string()), @@ -992,7 +992,7 @@ mod test { LogicalType::Varchar(None, CharLengthUnits::Characters), BinaryOperator::Lt, )?; - debug_assert_eq!( + assert_eq!( evaluator.0.binary_eval( &DataValue::Utf8 { value: Some("a".to_string()), @@ -1011,7 +1011,7 @@ mod test { LogicalType::Varchar(None, CharLengthUnits::Characters), BinaryOperator::GtEq, )?; - debug_assert_eq!( + assert_eq!( evaluator.0.binary_eval( &DataValue::Utf8 { value: Some("a".to_string()), @@ -1030,7 +1030,7 @@ mod test { LogicalType::Varchar(None, CharLengthUnits::Characters), BinaryOperator::LtEq, )?; - debug_assert_eq!( + assert_eq!( evaluator.0.binary_eval( &DataValue::Utf8 { value: Some("a".to_string()), @@ -1049,7 +1049,7 @@ mod test { LogicalType::Varchar(None, CharLengthUnits::Characters), BinaryOperator::NotEq, )?; - debug_assert_eq!( + assert_eq!( evaluator.0.binary_eval( &DataValue::Utf8 { value: Some("a".to_string()), @@ -1068,7 +1068,7 @@ mod test { LogicalType::Varchar(None, CharLengthUnits::Characters), BinaryOperator::Eq, )?; - debug_assert_eq!( + assert_eq!( evaluator.0.binary_eval( &DataValue::Utf8 { value: Some("a".to_string()), @@ -1087,7 +1087,7 @@ mod test { LogicalType::Varchar(None, CharLengthUnits::Characters), BinaryOperator::Gt, )?; - debug_assert_eq!( + assert_eq!( evaluator.0.binary_eval( &DataValue::Utf8 { value: None, @@ -1106,7 +1106,7 @@ mod test { LogicalType::Varchar(None, CharLengthUnits::Characters), BinaryOperator::Lt, )?; - debug_assert_eq!( + assert_eq!( evaluator.0.binary_eval( &DataValue::Utf8 { value: None, @@ -1125,7 +1125,7 @@ mod test { LogicalType::Varchar(None, CharLengthUnits::Characters), BinaryOperator::GtEq, )?; - debug_assert_eq!( + assert_eq!( evaluator.0.binary_eval( &DataValue::Utf8 { value: None, @@ -1144,7 +1144,7 @@ mod test { LogicalType::Varchar(None, CharLengthUnits::Characters), BinaryOperator::LtEq, )?; - debug_assert_eq!( + assert_eq!( evaluator.0.binary_eval( &DataValue::Utf8 { value: None, @@ -1163,7 +1163,7 @@ mod test { LogicalType::Varchar(None, CharLengthUnits::Characters), BinaryOperator::NotEq, )?; - debug_assert_eq!( + assert_eq!( evaluator.0.binary_eval( &DataValue::Utf8 { value: None, diff --git a/src/types/tuple.rs b/src/types/tuple.rs index 39a0a6c3..3acecb86 100644 --- a/src/types/tuple.rs +++ b/src/types/tuple.rs @@ -378,7 +378,7 @@ mod tests { &tuples[1].serialize_to(&types).unwrap(), ); - debug_assert_eq!(tuples[0], tuple_0); - debug_assert_eq!(tuples[1], tuple_1); + assert_eq!(tuples[0], tuple_0); + assert_eq!(tuples[1], tuple_1); } } diff --git a/src/types/value.rs b/src/types/value.rs index 04f0ff99..27adc59e 100644 --- a/src/types/value.rs +++ b/src/types/value.rs @@ -1651,8 +1651,8 @@ mod test { println!("{:?} < {:?}", key_i8_1, key_i8_2); println!("{:?} < {:?}", key_i8_2, key_i8_3); - debug_assert!(key_i8_1 < key_i8_2); - debug_assert!(key_i8_2 < key_i8_3); + assert!(key_i8_1 < key_i8_2); + assert!(key_i8_2 < key_i8_3); let mut key_i16_1 = Vec::new(); let mut key_i16_2 = Vec::new(); @@ -1664,8 +1664,8 @@ mod test { println!("{:?} < {:?}", key_i16_1, key_i16_2); println!("{:?} < {:?}", key_i16_2, key_i16_3); - debug_assert!(key_i16_1 < key_i16_2); - debug_assert!(key_i16_2 < key_i16_3); + assert!(key_i16_1 < key_i16_2); + assert!(key_i16_2 < key_i16_3); let mut key_i32_1 = Vec::new(); let mut key_i32_2 = Vec::new(); @@ -1677,8 +1677,8 @@ mod test { println!("{:?} < {:?}", key_i32_1, key_i32_2); println!("{:?} < {:?}", key_i32_2, key_i32_3); - debug_assert!(key_i32_1 < key_i32_2); - debug_assert!(key_i32_2 < key_i32_3); + assert!(key_i32_1 < key_i32_2); + assert!(key_i32_2 < key_i32_3); let mut key_i64_1 = Vec::new(); let mut key_i64_2 = Vec::new(); @@ -1690,8 +1690,8 @@ mod test { println!("{:?} < {:?}", key_i64_1, key_i64_2); println!("{:?} < {:?}", key_i64_2, key_i64_3); - debug_assert!(key_i64_1 < key_i64_2); - debug_assert!(key_i64_2 < key_i64_3); + assert!(key_i64_1 < key_i64_2); + assert!(key_i64_2 < key_i64_3); Ok(()) } @@ -1708,8 +1708,8 @@ mod test { println!("{:?} < {:?}", key_f32_1, key_f32_2); println!("{:?} < {:?}", key_f32_2, key_f32_3); - debug_assert!(key_f32_1 < key_f32_2); - debug_assert!(key_f32_2 < key_f32_3); + assert!(key_f32_1 < key_f32_2); + assert!(key_f32_2 < key_f32_3); let mut key_f64_1 = Vec::new(); let mut key_f64_2 = Vec::new(); @@ -1721,8 +1721,8 @@ mod test { println!("{:?} < {:?}", key_f64_1, key_f64_2); println!("{:?} < {:?}", key_f64_2, key_f64_3); - debug_assert!(key_f64_1 < key_f64_2); - debug_assert!(key_f64_2 < key_f64_3); + assert!(key_f64_1 < key_f64_2); + assert!(key_f64_2 < key_f64_3); Ok(()) } @@ -1754,8 +1754,8 @@ mod test { println!("{:?} < {:?}", key_tuple_1, key_tuple_2); println!("{:?} < {:?}", key_tuple_2, key_tuple_3); - debug_assert!(key_tuple_1 < key_tuple_2); - debug_assert!(key_tuple_2 < key_tuple_3); + assert!(key_tuple_1 < key_tuple_2); + assert!(key_tuple_2 < key_tuple_3); Ok(()) } diff --git a/src/utils/bit_vector.rs b/src/utils/bit_vector.rs index 3e11b777..4a0fd674 100644 --- a/src/utils/bit_vector.rs +++ b/src/utils/bit_vector.rs @@ -77,9 +77,9 @@ mod tests { let vector = BitVector::from_raw(&bytes); for i in 0..98 { - debug_assert!(!vector.get_bit(i)); + assert!(!vector.get_bit(i)); } - debug_assert!(vector.get_bit(99)); + assert!(vector.get_bit(99)); } #[test] @@ -89,8 +89,8 @@ mod tests { vector.set_bit(99, true); for i in 0..98 { - debug_assert!(!vector.get_bit(i)); + assert!(!vector.get_bit(i)); } - debug_assert!(vector.get_bit(99)); + assert!(vector.get_bit(99)); } } diff --git a/src/utils/lru.rs b/src/utils/lru.rs index 3db44448..e227ad4e 100644 --- a/src/utils/lru.rs +++ b/src/utils/lru.rs @@ -396,35 +396,35 @@ mod tests { #[test] fn test_lru_cache() { let mut lru = LruCache::new(3).unwrap(); - debug_assert!(lru.is_empty()); - debug_assert_eq!(lru.put(1, 10), None); - debug_assert_eq!(lru.put(2, 20), None); - debug_assert_eq!(lru.put(3, 30), None); - debug_assert_eq!(lru.get(&1), Some(&10)); - debug_assert_eq!(lru.put(2, 200), Some(20)); - debug_assert_eq!(lru.put(4, 40), None); - debug_assert_eq!(lru.get(&2), Some(&200)); - debug_assert_eq!(lru.get(&3), None); + assert!(lru.is_empty()); + assert_eq!(lru.put(1, 10), None); + assert_eq!(lru.put(2, 20), None); + assert_eq!(lru.put(3, 30), None); + assert_eq!(lru.get(&1), Some(&10)); + assert_eq!(lru.put(2, 200), Some(20)); + assert_eq!(lru.put(4, 40), None); + assert_eq!(lru.get(&2), Some(&200)); + assert_eq!(lru.get(&3), None); - debug_assert_eq!(lru.get_or_insert(9, |_| Ok(9)).unwrap(), &9); + assert_eq!(lru.get_or_insert(9, |_| Ok(9)).unwrap(), &9); - debug_assert_eq!(lru.len(), 3); - debug_assert!(!lru.is_empty()); + assert_eq!(lru.len(), 3); + assert!(!lru.is_empty()); let mut set = HashSet::from([(&9, &9), (&2, &200), (&4, &40)]); for item in lru.iter() { - debug_assert!(set.remove(&item)) + assert!(set.remove(&item)) } } #[test] fn test_shared_cache() { let lru = SharedLruCache::new(4, 2, RandomState::default()).unwrap(); - debug_assert!(lru.is_empty()); - debug_assert_eq!(lru.put(1, 10), None); - debug_assert_eq!(lru.get(&1), Some(&10)); - debug_assert!(!lru.is_empty()); - debug_assert_eq!(lru.get_or_insert(9, |_| Ok(9)).unwrap(), &9); + assert!(lru.is_empty()); + assert_eq!(lru.put(1, 10), None); + assert_eq!(lru.get(&1), Some(&10)); + assert!(!lru.is_empty()); + assert_eq!(lru.get_or_insert(9, |_| Ok(9)).unwrap(), &9); } }