Skip to content

Minor: Remove wrong comment on Accumulator::evaluate and Accumulator::state#12001

Merged
comphead merged 4 commits intoapache:mainfrom
lewiszlw:accumulator-evaluate-doc
Aug 16, 2024
Merged

Minor: Remove wrong comment on Accumulator::evaluate and Accumulator::state#12001
comphead merged 4 commits intoapache:mainfrom
lewiszlw:accumulator-evaluate-doc

Conversation

@lewiszlw
Copy link
Copy Markdown
Member

@lewiszlw lewiszlw commented Aug 15, 2024

Which issue does this PR close?

I checked some Accumulator implementations, they all won't clear internal state after evaluate or state call.

Rationale for this change

What changes are included in this PR?

Are these changes tested?

Are there any user-facing changes?

@lewiszlw lewiszlw changed the title Minor: Remove wrong comment on Accumulator::evaluate Minor: Remove wrong comment on Accumulator::evaluate and Accumulator::state Aug 15, 2024
@jayzhan211
Copy link
Copy Markdown
Contributor

I guess although it is not cleanup (the state is different), but it is also "not used" after all 🤔

@lewiszlw
Copy link
Copy Markdown
Member Author

I guess the author may want to reuse accumulator after call, but actually not.

/// 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.

Copy link
Copy Markdown
Contributor

@alamb alamb left a comment

Choose a reason for hiding this comment

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

Thank you @lewiszlw

Copy link
Copy Markdown
Contributor

@comphead comphead left a comment

Choose a reason for hiding this comment

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

👍

@comphead comphead merged commit 08f6e54 into apache:main Aug 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants