-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
simple mode f #11
simple mode f #11
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@@ -122,7 +122,7 @@ where | |||
} | |||
std::cmp::Ordering::Equal => { | |||
max_value = match max_value { | |||
Some(ref current_max_value) if value < current_max_value => Some(*value), | |||
Some(ref current_max_value) if value > current_max_value => Some(*value), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why this change?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Previously, we returned the MIN value for native types and the first encountered value for strings when multiple values had the same frequency. Now, MAX is used for both, but we can go with MIN in both cases, by the way.
DataType::Utf8 => Box::new(BytesModeAccumulator::<i32>::new(OutputType::Utf8)), | ||
DataType::LargeUtf8 => Box::new(BytesModeAccumulator::<i64>::new(OutputType::Utf8)), | ||
DataType::Utf8View => Box::new(BytesViewModeAccumulator::new(OutputType::Utf8View)), | ||
DataType::Utf8 | DataType::Utf8View | DataType::LargeUtf8 => Box::new(BytesModeAccumulator::new(data_type)), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
src/common/mode/bytes.rs
Outdated
V: ArrayAccessor<Item = &'a str>, | ||
{ | ||
for value in ArrayIter::new(array).flatten() { | ||
let key = value.to_string(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if you can avoid converting the value to a string here it would likely be significantly faster (it would avoid allocating on each row)
So maybe you could only call to_string()
right before you insert into the map
😍 |
Thanks @dmitrybugakov |
Thank you for the review, @alamb |
Closes: #10