Skip to content

Commit

Permalink
Fix negative float constant
Browse files Browse the repository at this point in the history
  • Loading branch information
cswinter committed Aug 1, 2024
1 parent fc541af commit 202083b
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/engine/planning/query_plan.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1372,6 +1372,13 @@ impl QueryPlan {
column_len,
planner,
)?,
Func1(Func1Type::Negate, box Const(RawVal::Float(f))) => QueryPlan::compile_expr(
&Const(RawVal::Float(-f)),
filter,
columns,
column_len,
planner,
)?,
Func1(ftype, ref inner) => {
let (plan, t) =
QueryPlan::compile_expr(inner, filter, columns, column_len, planner)?;
Expand Down
11 changes: 11 additions & 0 deletions tests/query_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1918,3 +1918,14 @@ fn test_floor2() {
],
);
}

#[test]
fn test_negative_constant() {
test_query_ec(
"SELECT id FROM default WHERE id - 3 <= -1.15 ORDER BY id;",
&[
vec![Int(0)],
vec![Int(1)],
],
);
}

0 comments on commit 202083b

Please sign in to comment.