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

Method find_window_func

datafusion/sql/src/expr/function.rs:975–996  ·  view source on GitHub ↗
(
        &self,
        name: &str,
    )

Source from the content-addressed store, hash-verified

973 }
974
975 pub(super) fn find_window_func(
976 &self,
977 name: &str,
978 ) -> Result<WindowFunctionDefinition> {
979 // Check udaf first
980 let udaf = self.context_provider.get_aggregate_meta(name);
981 // Use the builtin window function instead of the user-defined aggregate function
982 if udaf.as_ref().is_some_and(|udaf| {
983 udaf.name() != "first_value"
984 && udaf.name() != "last_value"
985 && udaf.name() != "nth_value"
986 }) {
987 Ok(WindowFunctionDefinition::AggregateUDF(udaf.unwrap()))
988 } else {
989 self.context_provider
990 .get_window_meta(name)
991 .map(WindowFunctionDefinition::WindowUDF)
992 .ok_or_else(|| {
993 plan_datafusion_err!("There is no window function named {name}")
994 })
995 }
996 }
997
998 fn sql_fn_arg_to_logical_expr(
999 &self,

Callers 1

sql_function_to_exprMethod · 0.80

Calls 6

AggregateUDFClass · 0.85
get_aggregate_metaMethod · 0.45
as_refMethod · 0.45
nameMethod · 0.45
mapMethod · 0.45
get_window_metaMethod · 0.45

Tested by

no test coverage detected