Skip to content
Snippets Groups Projects
Commit f3354acf authored by EmirVildanov's avatar EmirVildanov
Browse files

fix: allow param under cast

parent 10b9e740
No related branches found
No related tags found
2 merge requests!449fix: allow param under cast,!433Code reusage refactoring
Pipeline #41854 passed
......@@ -2,6 +2,23 @@ use crate::ir::transformation::helpers::sql_to_optimized_ir;
use crate::ir::value::Value;
use pretty_assertions::assert_eq;
#[test]
fn front_param_in_cast() {
let pattern = r#"SELECT CAST(? AS INTEGER) FROM "test_space""#;
let plan = sql_to_optimized_ir(pattern, vec![Value::from(1_i64)]);
let expected_explain = String::from(
r#"projection (1::integer::int -> "COL_1")
scan "test_space"
execution options:
sql_vdbe_max_steps = 45000
vtable_max_rows = 5000
"#,
);
assert_eq!(expected_explain, plan.as_explain().unwrap());
}
#[test]
fn front_params1() {
let pattern = r#"SELECT "id", "FIRST_NAME" FROM "test_space"
......
......@@ -130,7 +130,6 @@ impl Plan {
/// # Errors
/// - Child node is not of the expression type.
pub fn add_cast(&mut self, expr_id: usize, to_type: Type) -> Result<usize, SbroadError> {
self.get_expression_node(expr_id)?;
let cast_expr = Expression::Cast {
child: expr_id,
to: to_type,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment