Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion prqlc/prqlc/src/sql/gen_expr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -432,7 +432,7 @@ fn try_into_between(expr: rq::Expr, ctx: &mut Context) -> Result<Option<sql_ast:

// We need for the values on each arm to be the same; e.g. x
// > 3 and x < 5
if a_l == b_l {
if a_l.kind == b_l.kind {
return Ok(Some(sql_ast::Expr::Between {
expr: Box::new(
translate_operand(a_l, true, 0, Associativity::Both, ctx)?
Expand Down
15 changes: 15 additions & 0 deletions prqlc/prqlc/tests/integration/sql.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1575,6 +1575,21 @@ fn test_ranges() {
");
}

#[test]
fn test_between_from_comparison() {
assert_snapshot!((compile(r###"
from t
filter (a >= 5 && a <= 10)
"###).unwrap()), @r"
SELECT
*
FROM
t
WHERE
a BETWEEN 5 AND 10
");
}

#[test]
fn test_in_values_01() {
assert_snapshot!((compile(r#"
Expand Down
Loading