Skip to content

Commit 1fb0b0c

Browse files
committed
fix ci
1 parent 6e4ca51 commit 1fb0b0c

File tree

1 file changed

+13
-11
lines changed

1 file changed

+13
-11
lines changed

datafusion/expr/src/expr.rs

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -502,12 +502,6 @@ impl AggregateFunctionDefinition {
502502
AggregateFunctionDefinition::Name(func_name) => func_name.as_ref(),
503503
}
504504
}
505-
506-
pub fn new_builtin(
507-
fun: aggregate_function::AggregateFunction,
508-
) -> AggregateFunctionDefinition {
509-
Self::BuiltIn(fun)
510-
}
511505
}
512506

513507
/// Aggregate function
@@ -534,7 +528,7 @@ impl AggregateFunction {
534528
order_by: Option<Vec<Expr>>,
535529
) -> Self {
536530
Self {
537-
func_def: AggregateFunctionDefinition::new_builtin(fun),
531+
func_def: AggregateFunctionDefinition::BuiltIn(fun),
538532
args,
539533
distinct,
540534
filter,
@@ -1611,7 +1605,7 @@ fn create_name(e: &Expr) -> Result<String> {
16111605
filter,
16121606
order_by,
16131607
}) => {
1614-
let mut name = match func_def {
1608+
let name = match func_def {
16151609
AggregateFunctionDefinition::BuiltIn(..)
16161610
| AggregateFunctionDefinition::Name(..) => {
16171611
create_function_name(func_def.name(), *distinct, args)?
@@ -1624,13 +1618,21 @@ fn create_name(e: &Expr) -> Result<String> {
16241618
names.join(",")
16251619
}
16261620
};
1621+
let mut info = String::new();
16271622
if let Some(fe) = filter {
1628-
name = format!("{name} FILTER (WHERE {fe})");
1623+
info += &format!(" FILTER (WHERE {fe})");
16291624
};
16301625
if let Some(order_by) = order_by {
1631-
name = format!("{name} ORDER BY [{}]", expr_vec_fmt!(order_by));
1626+
info += &format!("{name} ORDER BY [{}]", expr_vec_fmt!(order_by));
16321627
};
1633-
Ok(name)
1628+
1629+
match func_def {
1630+
AggregateFunctionDefinition::BuiltIn(..)
1631+
| AggregateFunctionDefinition::Name(..) => Ok(name),
1632+
AggregateFunctionDefinition::UDF(..) => {
1633+
Ok(format!("{}({}){}", func_def.name(), name, info))
1634+
}
1635+
}
16341636
}
16351637
Expr::GroupingSet(grouping_set) => match grouping_set {
16361638
GroupingSet::Rollup(exprs) => {

0 commit comments

Comments
 (0)