From a5c3c844eea5b17e74a88947a4fcd9bd011c9d5f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BC=A0=E6=9E=97=E4=BC=9F?= Date: Thu, 15 Aug 2024 14:02:14 +0800 Subject: [PATCH 1/4] Remove wrong comment --- datafusion/expr-common/src/accumulator.rs | 3 --- 1 file changed, 3 deletions(-) diff --git a/datafusion/expr-common/src/accumulator.rs b/datafusion/expr-common/src/accumulator.rs index 262646d8ba3a..3c36d31b61bc 100644 --- a/datafusion/expr-common/src/accumulator.rs +++ b/datafusion/expr-common/src/accumulator.rs @@ -64,9 +64,6 @@ 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 - /// equivalent to when it was first created. - /// /// This function gets `&mut self` to allow for the accumulator to build /// arrow compatible internal state that can be returned without copying /// when possible (for example distinct strings) From 76030559c40c9a8243b632ce34dbe6e36749ddf8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BC=A0=E6=9E=97=E4=BC=9F?= Date: Thu, 15 Aug 2024 14:22:07 +0800 Subject: [PATCH 2/4] Remove wrong comment on Accumulator::state --- datafusion/expr-common/src/accumulator.rs | 3 --- 1 file changed, 3 deletions(-) diff --git a/datafusion/expr-common/src/accumulator.rs b/datafusion/expr-common/src/accumulator.rs index 3c36d31b61bc..d5412b0988e7 100644 --- a/datafusion/expr-common/src/accumulator.rs +++ b/datafusion/expr-common/src/accumulator.rs @@ -82,9 +82,6 @@ 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 gets `&mut self` to allow for the accumulator to build /// arrow compatible internal state that can be returned without copying /// when possible (for example distinct strings). From 6d79900eea9644a8775c1deb37deea32fd39bbcd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BC=A0=E6=9E=97=E4=BC=9F?= Date: Fri, 16 Aug 2024 10:24:00 +0800 Subject: [PATCH 3/4] Not call twice comment --- datafusion/expr-common/src/accumulator.rs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/datafusion/expr-common/src/accumulator.rs b/datafusion/expr-common/src/accumulator.rs index d5412b0988e7..bee176fd9b61 100644 --- a/datafusion/expr-common/src/accumulator.rs +++ b/datafusion/expr-common/src/accumulator.rs @@ -61,6 +61,9 @@ pub trait Accumulator: Send + Sync + Debug { /// Returns the final aggregate value, consuming the internal state. /// + /// This function should not be called twice, otherwise it will + /// result in potentially non-deterministic behavior. + /// /// For example, the `SUM` accumulator maintains a running sum, /// and `evaluate` will produce that running sum as its output. /// @@ -82,6 +85,9 @@ pub trait Accumulator: Send + Sync + Debug { /// Returns the intermediate state of the accumulator, consuming the /// intermediate state. /// + /// 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 /// when possible (for example distinct strings). From 8e6646cceb9938302c8aa41fdd999e6b56e05a0f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BC=A0=E6=9E=97=E4=BC=9F?= Date: Fri, 16 Aug 2024 10:27:53 +0800 Subject: [PATCH 4/4] Adjust comment order --- datafusion/expr-common/src/accumulator.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/datafusion/expr-common/src/accumulator.rs b/datafusion/expr-common/src/accumulator.rs index bee176fd9b61..eac91c4f8efc 100644 --- a/datafusion/expr-common/src/accumulator.rs +++ b/datafusion/expr-common/src/accumulator.rs @@ -61,12 +61,12 @@ pub trait Accumulator: Send + Sync + Debug { /// Returns the final aggregate value, consuming the internal state. /// - /// This function should not be called twice, otherwise it will - /// result in potentially non-deterministic behavior. - /// /// For example, the `SUM` accumulator maintains a running sum, /// and `evaluate` will produce that running sum as its output. /// + /// 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 /// when possible (for example distinct strings)