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

Function first_value_agg_expr

datafusion/physical-plan/src/aggregates/mod.rs:3076–3100  ·  view source on GitHub ↗
(
        schema: &SchemaRef,
        column: &str,
        alias: &str,
        human_display: Option<&str>,
        human_display_alias: Option<&str>,
    )

Source from the content-addressed store, hash-verified

3074 }
3075
3076 fn first_value_agg_expr(
3077 schema: &SchemaRef,
3078 column: &str,
3079 alias: &str,
3080 human_display: Option<&str>,
3081 human_display_alias: Option<&str>,
3082 ) -> Result<AggregateFunctionExpr> {
3083 let mut builder =
3084 AggregateExprBuilder::new(first_value_udaf(), vec![col(column, schema)?])
3085 .order_by(vec![PhysicalSortExpr {
3086 expr: col(column, schema)?,
3087 options: SortOptions::new(false, false),
3088 }])
3089 .schema(Arc::clone(schema))
3090 .alias(alias);
3091
3092 if let Some(human_display) = human_display {
3093 builder = builder.human_display(human_display);
3094 }
3095 if let Some(human_display_alias) = human_display_alias {
3096 builder = builder.human_display_alias(human_display_alias);
3097 }
3098
3099 builder.build()
3100 }
3101
3102 #[test]
3103 fn test_reverse_expr_preserves_aliased_human_display() -> Result<()> {

Calls 7

newFunction · 0.85
human_display_aliasMethod · 0.80
aliasMethod · 0.45
schemaMethod · 0.45
order_byMethod · 0.45
human_displayMethod · 0.45
buildMethod · 0.45

Used in the wild real call sites across dependent graphs

searching dependent graphs…