vegafusion_runtime/expression/compiler/builtin_functions/type_coercion/
to_boolean.rs1use datafusion_expr::Expr;
2use vegafusion_common::datafusion_common::DFSchema;
3use vegafusion_common::datatypes::to_boolean;
4use vegafusion_core::error::{Result, VegaFusionError};
5
6pub fn to_boolean_transform(args: &[Expr], schema: &DFSchema) -> Result<Expr> {
7 if args.len() == 1 {
8 let arg = args[0].clone();
9 to_boolean(arg, schema)
10 } else {
11 Err(VegaFusionError::parse(format!(
12 "toBoolean requires a single argument. Received {} arguments",
13 args.len()
14 )))
15 }
16}