diff --git a/src/daft-connect/src/translation/expr/unresolved_function.rs b/src/daft-connect/src/translation/expr/unresolved_function.rs index cdd170e155..1fd21d9041 100644 --- a/src/daft-connect/src/translation/expr/unresolved_function.rs +++ b/src/daft-connect/src/translation/expr/unresolved_function.rs @@ -24,10 +24,28 @@ pub fn unresolved_to_daft_expr(f: UnresolvedFunction) -> eyre::Result handle_count(arguments).wrap_err("Failed to handle count function"), + "<" => handle_binary_op(arguments, daft_dsl::Operator::Lt) + .wrap_err("Failed to handle < function"), n => bail!("Unresolved function {n} not yet supported"), } } +pub fn handle_binary_op( + arguments: Vec, + op: daft_dsl::Operator, +) -> eyre::Result { + let arguments: [daft_dsl::ExprRef; 2] = match arguments.try_into() { + Ok(arguments) => arguments, + Err(arguments) => { + bail!("requires exactly two arguments; got {arguments:?}"); + } + }; + + let [left, right] = arguments; + + Ok(daft_dsl::binary_op(op, left, right)) +} + pub fn handle_count(_arguments: Vec) -> eyre::Result { error!("Warning: count function not yet supported; using placeholder 1 instead; see https://github.com/Eventual-Inc/Daft/issues/1979"); Ok(daft_dsl::lit(1))