Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
pola-rs
GitHub Repository: pola-rs/polars
Path: blob/main/crates/polars-mem-engine/src/executors/udf.rs
6940 views
1
use super::*;
2
3
pub(crate) struct UdfExec {
4
pub(crate) input: Box<dyn Executor>,
5
pub(crate) function: FunctionIR,
6
}
7
8
impl Executor for UdfExec {
9
fn execute(&mut self, state: &mut ExecutionState) -> PolarsResult<DataFrame> {
10
state.should_stop()?;
11
#[cfg(debug_assertions)]
12
{
13
if state.verbose() {
14
eprintln!("run UdfExec")
15
}
16
}
17
let df = self.input.execute(state)?;
18
19
let profile_name = if state.has_node_timer() {
20
Cow::Owned(format!("{}", self.function))
21
} else {
22
Cow::Borrowed("")
23
};
24
state.record(|| self.function.evaluate(df), profile_name)
25
}
26
}
27
28