Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ impl<I: DecimalType + Debug, S: DecimalType + Debug> DecimalDistinctAvgAccumulat
let data_type = I::TYPE_CONSTRUCTOR(I::MAX_PRECISION, sum_scale);

Self {
sum_accumulator: DistinctSumAccumulator::new(&data_type),
sum_accumulator: DistinctSumAccumulator::new(data_type),
sum_scale,
target_precision,
target_scale,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ impl Default for Float64DistinctAvgAccumulator {
fn default() -> Self {
Self {
sum_accumulator: DistinctSumAccumulator::<Float64Type>::new(
&DataType::Float64,
DataType::Float64,
),
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,10 @@ pub struct DistinctSumAccumulator<T: ArrowPrimitiveType> {
}

impl<T: ArrowPrimitiveType> DistinctSumAccumulator<T> {
pub fn new(data_type: &DataType) -> Self {
pub fn new(data_type: DataType) -> Self {
Self {
values: GenericDistinctBuffer::new(data_type.clone()),
data_type: data_type.clone(),
data_type,

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is one clone removed

}
}

Expand Down
4 changes: 2 additions & 2 deletions datafusion/functions-aggregate/src/sum.rs
Original file line number Diff line number Diff line change
Expand Up @@ -264,14 +264,14 @@ impl AggregateUDFImpl for Sum {
if args.is_distinct {
macro_rules! helper {
($t:ty, $dt:expr) => {
Ok(Box::new(DistinctSumAccumulator::<$t>::new(&$dt)))
Ok(Box::new(DistinctSumAccumulator::<$t>::new($dt)))
};
}
downcast_sum!(args, helper)
} else {
macro_rules! helper {
($t:ty, $dt:expr) => {
Ok(Box::new(SumAccumulator::<$t>::new($dt.clone())))

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is the second clone removed

Ok(Box::new(SumAccumulator::<$t>::new($dt)))
};
}
downcast_sum!(args, helper)
Expand Down
Loading