Skip to content

Commit

Permalink
Fixed aggregate funcitons name and behavior
Browse files Browse the repository at this point in the history
  • Loading branch information
edmondop committed Jun 20, 2024
1 parent fe8669f commit 9446b0b
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions datafusion/functions-aggregate/src/min_max.rs
Original file line number Diff line number Diff line change
Expand Up @@ -560,7 +560,7 @@ impl AggregateUDFImpl for Max {
}

fn name(&self) -> &str {
"max"
"MAX"
}

fn signature(&self) -> &Signature {
Expand Down Expand Up @@ -596,12 +596,11 @@ impl AggregateUDFImpl for Max {
PrimitiveGroupsAccumulator::<$PRIMTYPE, _>::new(
data_type,
|cur, new| {
if *cur > new {
if *cur < new {
*cur = new
}
},
)
// Initialize each accumulator to $NATIVE::MIN
.with_starting_value($NATIVE::MIN),
))
}};
Expand Down Expand Up @@ -730,7 +729,7 @@ impl AggregateUDFImpl for Min {
}

fn name(&self) -> &str {
"Min"
"MIN"
}

fn signature(&self) -> &Signature {
Expand Down Expand Up @@ -766,13 +765,12 @@ impl AggregateUDFImpl for Min {
PrimitiveGroupsAccumulator::<$PRIMTYPE, _>::new(
data_type,
|cur, new| {
if *cur < new {
if *cur > new {
*cur = new
}
},
)
// Initialize each accumulator to $NATIVE::MIN
.with_starting_value($NATIVE::MIN),
.with_starting_value($NATIVE::MAX),
))
}};
}
Expand Down

0 comments on commit 9446b0b

Please sign in to comment.