MCPcopy Create free account
hub / github.com/apache/datafusion / map_expr

Method map_expr

datafusion/physical-plan/src/async_func.rs:353–374  ·  view source on GitHub ↗

If the expression matches any of the async functions, return the new column

(
        &self,
        expr: Arc<dyn PhysicalExpr>,
    )

Source from the content-addressed store, hash-verified

351
352 /// If the expression matches any of the async functions, return the new column
353 pub fn map_expr(
354 &self,
355 expr: Arc<dyn PhysicalExpr>,
356 ) -> Transformed<Arc<dyn PhysicalExpr>> {
357 // find the first matching async function if any
358 let Some(idx) =
359 self.async_exprs
360 .iter()
361 .enumerate()
362 .find_map(|(idx, async_expr)| {
363 if async_expr.func == Arc::clone(&expr) {
364 Some(idx)
365 } else {
366 None
367 }
368 })
369 else {
370 return Transformed::no(expr);
371 };
372 // rewrite in terms of the output column
373 Transformed::yes(self.output_column(idx))
374 }
375
376 /// return the output column for the async function at index idx
377 pub fn output_column(&self, idx: usize) -> Arc<dyn PhysicalExpr> {

Callers 1

try_plan_async_exprsMethod · 0.80

Calls 2

output_columnMethod · 0.80
iterMethod · 0.45

Tested by

no test coverage detected