ozankabak commented on code in PR #11845: URL: https://github.com/apache/datafusion/pull/11845#discussion_r1707396680
########## datafusion/physical-expr-functions-aggregate/src/aggregate.rs: ########## Review Comment: A few minor things remaining in this file (like removing the `create_aggregate_expr` in favor of `AggregateExprBuilder`) ########## datafusion/functions-aggregate-common/src/aggregate.rs: ########## @@ -0,0 +1,179 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +use crate::order::AggregateOrderSensitivity; +use arrow::datatypes::Field; +use datafusion_common::exec_err; +use datafusion_common::{not_impl_err, Result}; +use datafusion_expr_common::accumulator::Accumulator; +use datafusion_expr_common::groups_accumulator::GroupsAccumulator; +use datafusion_physical_expr_common::physical_expr::PhysicalExpr; +use datafusion_physical_expr_common::sort_expr::PhysicalSortExpr; +use std::fmt::Debug; +use std::{any::Any, sync::Arc}; Review Comment: ```suggestion //! Contains the trait `AggregateExpr` which defines the interface all aggregate expressions //! (built-in and custom) need to satisfy. use std::fmt::Debug; use std::{any::Any, sync::Arc}; use crate::order::AggregateOrderSensitivity; use arrow::datatypes::Field; use datafusion_common::{exec_err, not_impl_err, Result}; use datafusion_expr_common::accumulator::Accumulator; use datafusion_expr_common::groups_accumulator::GroupsAccumulator; use datafusion_physical_expr_common::physical_expr::PhysicalExpr; use datafusion_physical_expr_common::sort_expr::PhysicalSortExpr; ``` ########## datafusion/functions-aggregate/src/stddev.rs: ########## @@ -331,25 +331,26 @@ mod tests { schema, dfschema: &dfschema, ignore_nulls: false, - sort_exprs: &[], + ordering_req: &[], name: "a", is_distinct: false, is_reversed: false, input_types: &[DataType::Float64], - input_exprs: &[datafusion_expr::col("a")], + exprs: &[col("a", schema)?], }; let args2 = AccumulatorArgs { data_type: &DataType::Float64, schema, dfschema: &dfschema, ignore_nulls: false, - sort_exprs: &[], + // sort_exprs: &[], Review Comment: Seems like a leftover ########## datafusion/expr/src/operation.rs: ########## @@ -0,0 +1,224 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +//! Operator module contains foundational types that are used to represent operators in DataFusion. + +use crate::expr_fn::binary_expr; +use crate::Expr; +use crate::Like; +use datafusion_expr_common::operator::Operator; +use std::ops; +use std::ops::Not; Review Comment: ```suggestion use std::ops::{self, Not}; use crate::expr_fn::binary_expr; use crate::{Expr, Like}; use datafusion_expr_common::operator::Operator; ``` ########## datafusion/physical-plan/src/aggregates/mod.rs: ########## @@ -2256,23 +2176,13 @@ mod tests { ]; let mut aggr_exprs = order_by_exprs .into_iter() - .zip(sort_exprs.into_iter()) - .map(|(order_by_expr, sort_exprs)| { + .map(|order_by_expr| { let ordering_req = order_by_expr.unwrap_or_default(); - let sort_exprs = sort_exprs.unwrap_or_default(); - create_aggregate_expr_with_dfschema( - &array_agg_udaf(), - &[Arc::clone(col_a)], - &[], - &sort_exprs, - &ordering_req, - &test_df_schema, - None, - false, - false, - false, - ) - .unwrap() + AggregateExprBuilder::new(array_agg_udaf(), vec![Arc::clone(col_a)]) + .order_by(ordering_req.to_vec()) + .schema(Arc::clone(&test_schema)) + .build() + .unwrap() Review Comment: ```suggestion AggregateExprBuilder::new(array_agg_udaf(), vec![Arc::clone(col_a)]) .order_by(ordering_req.to_vec()) .schema(Arc::clone(&test_schema)) .build()? ``` -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
