@@ -298,7 +298,16 @@ class Accumulator(metaclass=ABCMeta):
298298
299299 @abstractmethod
300300 def state (self ) -> list [pa .Scalar ]:
301- """Return the current state."""
301+ """Return the current state.
302+
303+ While this function template expects PyArrow Scalar values return type,
304+ you can return any value that can be converted into a Scalar. This
305+ includes basic Python data types such as integers and strings. In
306+ addition to primitive types, we currently support PyArrow, nanoarrow,
307+ and arro3 objects in addition to primitive data types. Other objects
308+ that support the Arrow FFI standard will be given a "best attempt" at
309+ conversion to scalar objects.
310+ """
302311
303312 @abstractmethod
304313 def update (self , * values : pa .Array ) -> None :
@@ -312,18 +321,13 @@ def merge(self, states: list[pa.Array]) -> None:
312321 def evaluate (self ) -> pa .Scalar :
313322 """Return the resultant value.
314323
315- If you need to return a list, wrap it in a scalar with the correct
316- list type, for example::
317-
318- import pyarrow as pa
319-
320- return pa.scalar(
321- [pa.scalar("2024-01-01T00:00:00Z")],
322- type=pa.list_(pa.timestamp("ms")),
323- )
324-
325- Returning a ``pyarrow.Array`` from ``evaluate`` is not supported unless
326- you explicitly convert it to a list-valued scalar.
324+ While this function template expects a PyArrow Scalar value return type,
325+ you can return any value that can be converted into a Scalar. This
326+ includes basic Python data types such as integers and strings. In
327+ addition to primitive types, we currently support PyArrow, nanoarrow,
328+ and arro3 objects in addition to primitive data types. Other objects
329+ that support the Arrow FFI standard will be given a "best attempt" at
330+ conversion to scalar objects.
327331 """
328332
329333
0 commit comments