jayzhan211 commented on code in PR #27466:
URL: https://github.com/apache/datafusion/pull/27466#discussion_r4771582718
##########
datafusion/expr/src/partition_evaluator.rs:
##########
@@ -214,6 +221,14 @@ pub trait PartitionEvaluator: Debug + Send + std::any::Any
{
ScalarValue::iter_to_array(results)
}
+ /// Returns `true` if, until [`Self::memoize`] is called, the result of
+ /// [`Self::evaluate_ranges`] for a frame depends only on the rows of
+ /// `values` inside that frame. A new evaluator can then evaluate the
+ /// frames of several partitions, concatenated in `values`, in one call.
Review Comment:
Optional: the default `evaluate_ranges` builds its result with
`ScalarValue::iter_to_array`, which gives every row of a dictionary its own
key. A UDWF that sets this flag and returns `Dictionary(Int8, _)` can then hit
the same `Can not create index of type Int8 from value 128` error as the
aggregate case, once one call covers more than 127 rows of small partitions.
Calls of one partition each stayed under that limit. `nth_value` gathers with
`take`, so only user-defined functions are affected, and a doc line would warn
their authors:
```suggestion
/// Returns `true` if, until [`Self::memoize`] is called, the result of
/// [`Self::evaluate_ranges`] for a frame depends only on the rows of
/// `values` inside that frame. A new evaluator can then evaluate the
/// frames of several partitions, concatenated in `values`, in one call.
///
/// The default [`Self::evaluate_ranges`] builds its result with
/// [`ScalarValue::iter_to_array`], which gives every row of a dictionary
/// its own key. A function with a dictionary return type that sets this
/// flag should override `evaluate_ranges`, or the keys can overflow once
/// the partitions of one call hold more rows than the key type can
index.
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]