jcsherin commented on code in PR #12893:
URL: https://github.com/apache/datafusion/pull/12893#discussion_r1797706177
##########
datafusion/functions-window/src/rank.rs:
##########
@@ -80,11 +125,19 @@ impl WindowUDFImpl for Rank {
&self,
_partition_evaluator_args: PartitionEvaluatorArgs,
) -> Result<Box<dyn PartitionEvaluator>> {
- Ok(Box::<RankEvaluator>::default())
+ Ok(Box::new(RankEvaluator {
+ state: RankState::default(),
+ rank_type: self.rank_type,
+ }))
}
fn field(&self, field_args: WindowUDFFieldArgs) -> Result<Field> {
- Ok(Field::new(field_args.name(), DataType::UInt64, false))
+ let nullable = false;
+ Ok(Field::new(
+ field_args.name(),
+ self.data_type.clone(),
+ nullable,
+ ))
Review Comment:
The `Rank.data_type` field can be removed.
```suggestion
let return_type = match self.rank_type {
RankType::Basic | RankType::Dense => DataType::UInt64,
RankType::Percent => DataType::Float64,
};
Ok(Field::new(
field_args.name(),
return_type.clone(),
false,
))
```
--
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]