mustafasrepo commented on code in PR #4777:
URL: https://github.com/apache/arrow-datafusion/pull/4777#discussion_r1061305596
##########
datafusion/physical-expr/src/window/rank.rs:
##########
@@ -98,18 +99,77 @@ impl BuiltInWindowFunctionExpr for Rank {
&self.name
}
+ fn supports_bounded_execution(&self) -> bool {
+ matches!(self.rank_type, RankType::Basic | RankType::Dense)
+ }
+
fn create_evaluator(&self) -> Result<Box<dyn PartitionEvaluator>> {
Ok(Box::new(RankEvaluator {
+ state: RankState::default(),
rank_type: self.rank_type,
}))
}
}
+#[derive(Debug)]
pub(crate) struct RankEvaluator {
+ state: RankState,
rank_type: RankType,
}
impl PartitionEvaluator for RankEvaluator {
+ fn get_range(&self, state: &WindowAggState, _n_rows: usize) ->
Result<Range<usize>> {
+ Ok(Range {
+ start: state.last_calculated_index,
+ end: state.last_calculated_index + 1,
+ })
+ }
+
+ fn state(&self) -> Result<BuiltinWindowState> {
+ Ok(BuiltinWindowState::Rank(self.state.clone()))
+ }
+
+ fn update_state(
Review Comment:
I agree that, we can make the implementation of Builtin WindowFunctions more
similar to the aggregators. This will possibly increase code re-usage. We will
consider this point in follow-up PRs.
--
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]