Skip to content

Commit

Permalink
Fix lint
Browse files Browse the repository at this point in the history
  • Loading branch information
alamb committed Jul 14, 2023
1 parent f8a01c1 commit c6891cb
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 13 deletions.
2 changes: 1 addition & 1 deletion datafusion/core/src/physical_plan/aggregates/order/full.rs
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ impl GroupOrderingFull {
State::InProgress { current } => {
// shift down by n
assert!(*current >= n);
*current = *current - n;
*current -= n;
self.hashes.drain(0..n);
}
State::Complete { .. } => panic!("invalid state: complete"),
Expand Down
14 changes: 4 additions & 10 deletions datafusion/core/src/physical_plan/aggregates/order/partial.rs
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,10 @@ pub(crate) struct GroupOrderingPartial {
}

/// Tracks the state of the the grouping
#[derive(Debug)]
#[derive(Debug, Default)]
enum State {
/// Taken to potentially be updated.
#[default]
Taken,

/// Have seen no input yet
Expand All @@ -92,13 +93,6 @@ enum State {
Complete,
}

// Implement default so the state can be temporarily taken via `std::mem::take`
impl Default for State {
fn default() -> Self {
State::Taken
}
}

impl GroupOrderingPartial {
pub fn try_new(
input_schema: &Schema,
Expand Down Expand Up @@ -176,9 +170,9 @@ impl GroupOrderingPartial {
} => {
// shift indexes down by n
assert!(*current >= n);
*current = *current - n;
*current -= n;
assert!(*current_sort >= n);
*current_sort = *current_sort - n;
*current_sort -= n;
// Note sort_key stays the same, we are just translating group indexes
self.hashes.drain(0..n);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,11 +112,11 @@ pub trait GroupsAccumulator: Send {
/// each group, and `evaluate` will produce that running sum as
/// its output for all groups, in group_index order
///
/// If `emit_to`` is [`Emit::All`], the accumulator should return all
/// If `emit_to`` is [`EmitTo::All`], the accumulator should return all
/// groups and release / reset its internal state equivalent to
/// when it was first created.
///
/// If `emit_to` is [`Emit::First`], only the first `first` groups
/// If `emit_to` is [`EmitTo::First`], only the first `first` groups
/// should be emitted and the state for those first groups. State
/// for the remaining groups must be retained for future use. The
/// group_indices on subsequent calls to `update_batch` or
Expand Down

0 comments on commit c6891cb

Please sign in to comment.