MCPcopy Create free account
hub / github.com/PRQL/prql / translate_binary_operator

Function translate_binary_operator

prqlc/prqlc/src/sql/gen_expr.rs:387–402  ·  view source on GitHub ↗
(
    left: &rq::Expr,
    right: &rq::Expr,
    op: BinaryOperator,
    ctx: &mut Context,
)

Source from the content-addressed store, hash-verified

385}
386
387fn translate_binary_operator(
388 left: &rq::Expr,
389 right: &rq::Expr,
390 op: BinaryOperator,
391 ctx: &mut Context,
392) -> Result<sql_ast::Expr> {
393 let strength = op.binding_strength();
394
395 let left = translate_operand(left.clone(), true, strength, op.associativity(), ctx)?;
396 let right = translate_operand(right.clone(), false, strength, op.associativity(), ctx)?;
397
398 let left = Box::new(left.into_ast());
399 let right = Box::new(right.into_ast());
400
401 Ok(sql_ast::Expr::BinaryOp { left, op, right })
402}
403
404fn collect_concat_args(expr: &rq::Expr) -> Vec<&rq::Expr> {
405 match &expr.kind {

Callers 1

translate_exprFunction · 0.85

Calls 4

translate_operandFunction · 0.85
binding_strengthMethod · 0.80
into_astMethod · 0.80
associativityMethod · 0.45

Tested by

no test coverage detected