Skip to content

Commit 86da5a8

Browse files
rluvaton2010YOUY01
andauthored
chore(ordered-partial-aggregate): move OrderedPartialAggregateStream to generators for readability (#23951)
## Which issue does this PR close? N/A ## Rationale for this change Simplify the code by making it linear and with less state to hold in mind ## What changes are included in this PR? change `OrderedPartialAggregateStream` into async generators ## Are these changes tested? existing tests ## Are there any user-facing changes? no --------- Co-authored-by: Yongting You <2010youy01@gmail.com>
1 parent 0f7bddd commit 86da5a8

2 files changed

Lines changed: 136 additions & 261 deletions

File tree

‎datafusion/physical-plan/src/aggregates/mod.rs‎

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -697,7 +697,7 @@ impl From<StreamType> for SendableRecordBatchStream {
697697
StreamType::PartialReduceHash(stream) => Box::pin(stream),
698698
StreamType::FinalHash(stream) => Box::pin(stream),
699699
StreamType::SingleHash(stream) => Box::pin(stream),
700-
StreamType::OrderedPartialAggregate(stream) => Box::pin(stream),
700+
StreamType::OrderedPartialAggregate(stream) => stream.into_stream(),
701701
StreamType::OrderedFinalAggregate(stream) => Box::pin(stream),
702702
StreamType::GroupedHash(stream) => Box::pin(stream),
703703
StreamType::GroupedPriorityQueue(stream) => Box::pin(stream),
@@ -4429,9 +4429,8 @@ mod tests {
44294429
.with_session_config(session_config),
44304430
);
44314431

4432-
let mut stream: SendableRecordBatchStream = Box::pin(
4433-
OrderedPartialAggregateStream::new(&aggregate, &task_ctx, 0)?,
4434-
);
4432+
let mut stream: SendableRecordBatchStream =
4433+
OrderedPartialAggregateStream::new(&aggregate, &task_ctx, 0)?.into_stream();
44354434

44364435
while let Some(result) = stream.next().await {
44374436
if let Err(e) = result {

0 commit comments

Comments
 (0)