Skip to content
Merged
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
8 changes: 4 additions & 4 deletions datafusion/expr-common/src/accumulator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,8 @@ pub trait Accumulator: Send + Sync + Debug {
/// For example, the `SUM` accumulator maintains a running sum,
/// and `evaluate` will produce that running sum as its output.
///
/// After this call, the accumulator's internal state should be
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I think it would be better update the docs to explain what the state can be after calling the function rather than simply removing the docs.

For example, is it the case that

  • "calling evaluate twice should result in an error"?
  • "calling evaluate twice will result in potentially non deterministic behavior"?
  • Something else?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Agree concise documentation is quite important. Especially when DF becoming more feature rich and code is evolving

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Added "Not call twice" comment. Feel free to help me polish comment wording.

/// equivalent to when it was first created.
/// This function should not be called twice, otherwise it will
/// result in potentially non-deterministic behavior.
///
/// This function gets `&mut self` to allow for the accumulator to build
/// arrow compatible internal state that can be returned without copying
Expand All @@ -85,8 +85,8 @@ pub trait Accumulator: Send + Sync + Debug {
/// Returns the intermediate state of the accumulator, consuming the
/// intermediate state.
///
/// After this call, the accumulator's internal state should be
/// equivalent to when it was first created.
/// This function should not be called twice, otherwise it will
/// result in potentially non-deterministic behavior.
///
/// This function gets `&mut self` to allow for the accumulator to build
/// arrow compatible internal state that can be returned without copying
Expand Down