You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@datafusion.apache.org by "xudong963 (via GitHub)" <gi...@apache.org> on 2026/03/23 05:36:55 UTC

[PR] Fix/aggregate output ordering streaming (#33) [datafusion]

xudong963 opened a new pull request, #21107:
URL: https://github.com/apache/datafusion/pull/21107

   ## Which issue does this PR close?
   
   <!--
   We generally require a GitHub issue to be filed for all bug fixes and enhancements and this helps us generate change logs for our releases. You can link an issue to this PR using the GitHub syntax. For example `Closes #123` indicates that this PR will close issue #123.
   -->
   
   - Closes #.
   
   ## Rationale for this change
   
   <!--
    Why are you proposing this change? If this is already explained clearly in the issue then this section is not needed.
    Explaining clearly why changes are proposed helps reviewers understand your changes and offer better suggestions for fixes.  
   -->
   
   ## What changes are included in this PR?
   
   <!--
   There is no need to duplicate the description in the issue here but it is sometimes worth providing a summary of the individual changes in this PR.
   -->
   
   ## Are these changes tested?
   
   <!--
   We typically require tests for all PRs in order to:
   1. Prevent the code from being accidentally broken by subsequent changes
   2. Serve as another way to document the expected behavior of the code
   
   If tests are not included in your PR, please explain why (for example, are they covered by existing tests)?
   -->
   
   ## Are there any user-facing changes?
   
   <!--
   If there are user-facing changes then we may require documentation to be updated before approving the PR.
   -->
   
   <!--
   If there are any breaking changes to public APIs, please add the `api change` label.
   -->
   


-- 
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: github-unsubscribe@datafusion.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org


Re: [PR] Fix/aggregate output ordering streaming [datafusion]

Posted by "alamb (via GitHub)" <gi...@apache.org>.
alamb commented on code in PR #21107:
URL: https://github.com/apache/datafusion/pull/21107#discussion_r2981773938


##########
datafusion/sqllogictest/test_files/unnest.slt:
##########
@@ -987,15 +987,14 @@ logical_plan
 physical_plan
 01)ProjectionExec: expr=[array_agg(unnested.ar)@1 as array_agg(unnested.ar)]
 02)--AggregateExec: mode=FinalPartitioned, gby=[generated_id@0 as generated_id], aggr=[array_agg(unnested.ar)], ordering_mode=Sorted
-03)----SortExec: expr=[generated_id@0 ASC NULLS LAST], preserve_partitioning=[true]
-04)------RepartitionExec: partitioning=Hash([generated_id@0], 4), input_partitions=4
-05)--------AggregateExec: mode=Partial, gby=[generated_id@0 as generated_id], aggr=[array_agg(unnested.ar)], ordering_mode=Sorted
-06)----------ProjectionExec: expr=[generated_id@0 as generated_id, __unnest_placeholder(make_array(range().value),depth=1)@1 as ar]
-07)------------UnnestExec
-08)--------------ProjectionExec: expr=[row_number() ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING@1 as generated_id, make_array(value@0) as __unnest_placeholder(make_array(range().value))]
-09)----------------RepartitionExec: partitioning=RoundRobinBatch(4), input_partitions=1, maintains_sort_order=true
-10)------------------BoundedWindowAggExec: wdw=[row_number() ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING: Field { "row_number() ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING": UInt64 }, frame: ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING], mode=[Sorted]
-11)--------------------LazyMemoryExec: partitions=1, batch_generators=[range: start=1, end=5, batch_size=8192]
+03)----RepartitionExec: partitioning=Hash([generated_id@0], 4), input_partitions=4, preserve_order=true, sort_exprs=generated_id@0 ASC NULLS LAST
+04)------AggregateExec: mode=Partial, gby=[generated_id@0 as generated_id], aggr=[array_agg(unnested.ar)], ordering_mode=Sorted

Review Comment:
   this plan looks better to me (it still is fully parallelized and now uses avoids an unecessary hash repartition 



##########
datafusion/physical-optimizer/src/enforce_distribution.rs:
##########
@@ -928,6 +928,47 @@ fn add_hash_on_top(
 ///
 /// * `input`: Current node.
 ///
+/// Checks whether preserving the child's ordering enables the parent to
+/// run in streaming mode. Compares the parent's pipeline behavior with
+/// the ordered child vs. an unordered (coalesced) child. If removing the
+/// ordering would cause the parent to switch from streaming to blocking,
+/// keeping the order-preserving variant is beneficial.
+///
+/// Only applicable to single-child operators; returns false for multi-child
+/// operators (e.g. joins) where child substitution semantics are ambiguous.
+fn preserving_order_enables_streaming(
+    parent: &Arc<dyn ExecutionPlan>,
+    ordered_child: &Arc<dyn ExecutionPlan>,
+) -> bool {
+    // Only applicable to single-child operators that maintain input order
+    // (e.g. AggregateExec in PartiallySorted mode). Operators that don't
+    // maintain input order (e.g. SortExec) handle ordering themselves —
+    // preserving SPM for them is unnecessary.
+    if parent.children().len() != 1 {
+        return false;
+    }
+    if !parent.maintains_input_order()[0] {
+        return false;
+    }
+    // Build parent with the ordered child
+    let with_ordered =
+        match Arc::clone(parent).with_new_children(vec![Arc::clone(ordered_child)]) {
+            Ok(p) => p,
+            Err(_) => return false,
+        };
+    if with_ordered.pipeline_behavior() == EmissionType::Final {
+        // Parent is blocking even with ordering — no benefit
+        return false;
+    }
+    // Build parent with an unordered child (simulating CoalescePartitionsExec)

Review Comment:
   this commet is strange to me -- the code adds a CoalescePartitionsExec -- so I don't think it is "simulating" anything



##########
datafusion/physical-optimizer/src/enforce_distribution.rs:
##########
@@ -928,6 +928,47 @@ fn add_hash_on_top(
 ///
 /// * `input`: Current node.
 ///
+/// Checks whether preserving the child's ordering enables the parent to
+/// run in streaming mode. Compares the parent's pipeline behavior with
+/// the ordered child vs. an unordered (coalesced) child. If removing the
+/// ordering would cause the parent to switch from streaming to blocking,
+/// keeping the order-preserving variant is beneficial.
+///
+/// Only applicable to single-child operators; returns false for multi-child
+/// operators (e.g. joins) where child substitution semantics are ambiguous.
+fn preserving_order_enables_streaming(
+    parent: &Arc<dyn ExecutionPlan>,
+    ordered_child: &Arc<dyn ExecutionPlan>,
+) -> bool {
+    // Only applicable to single-child operators that maintain input order
+    // (e.g. AggregateExec in PartiallySorted mode). Operators that don't
+    // maintain input order (e.g. SortExec) handle ordering themselves —
+    // preserving SPM for them is unnecessary.
+    if parent.children().len() != 1 {
+        return false;
+    }
+    if !parent.maintains_input_order()[0] {
+        return false;
+    }
+    // Build parent with the ordered child
+    let with_ordered =
+        match Arc::clone(parent).with_new_children(vec![Arc::clone(ordered_child)]) {
+            Ok(p) => p,
+            Err(_) => return false,

Review Comment:
   I don't think we should ignore the Err here  or below as it could mask real errors / a bug with this code



-- 
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: github-unsubscribe@datafusion.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org


Re: [PR] Improvement: keep order-preserving repartitions for streaming aggregates [datafusion]

Posted by "niebayes (via GitHub)" <gi...@apache.org>.
niebayes commented on PR #21107:
URL: https://github.com/apache/datafusion/pull/21107#issuecomment-5025160721

   @alamb Will file a ticket soon


-- 
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: github-unsubscribe@datafusion.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org


Re: [PR] Improvement: keep order-preserving repartitions for streaming aggregates [datafusion]

Posted by "alamb (via GitHub)" <gi...@apache.org>.
alamb commented on PR #21107:
URL: https://github.com/apache/datafusion/pull/21107#issuecomment-5023342039

   Thanks @niebayes  - would you be willing to file a ticket with the user visible behavior (so that it is easier to discover than a comment on a PR)? Then just close the issue as "fixed in 54"? 


-- 
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: github-unsubscribe@datafusion.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org


Re: [PR] Improvement: keep order-preserving repartitions for streaming aggregates [datafusion]

Posted by "xudong963 (via GitHub)" <gi...@apache.org>.
xudong963 merged PR #21107:
URL: https://github.com/apache/datafusion/pull/21107


-- 
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: github-unsubscribe@datafusion.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org


Re: [PR] Fix/aggregate output ordering streaming [datafusion]

Posted by "xudong963 (via GitHub)" <gi...@apache.org>.
xudong963 commented on code in PR #21107:
URL: https://github.com/apache/datafusion/pull/21107#discussion_r2986959269


##########
datafusion/physical-optimizer/src/enforce_distribution.rs:
##########
@@ -928,6 +928,47 @@ fn add_hash_on_top(
 ///
 /// * `input`: Current node.
 ///
+/// Checks whether preserving the child's ordering enables the parent to
+/// run in streaming mode. Compares the parent's pipeline behavior with
+/// the ordered child vs. an unordered (coalesced) child. If removing the
+/// ordering would cause the parent to switch from streaming to blocking,
+/// keeping the order-preserving variant is beneficial.
+///
+/// Only applicable to single-child operators; returns false for multi-child
+/// operators (e.g. joins) where child substitution semantics are ambiguous.
+fn preserving_order_enables_streaming(
+    parent: &Arc<dyn ExecutionPlan>,
+    ordered_child: &Arc<dyn ExecutionPlan>,
+) -> bool {
+    // Only applicable to single-child operators that maintain input order
+    // (e.g. AggregateExec in PartiallySorted mode). Operators that don't
+    // maintain input order (e.g. SortExec) handle ordering themselves —
+    // preserving SPM for them is unnecessary.
+    if parent.children().len() != 1 {
+        return false;
+    }
+    if !parent.maintains_input_order()[0] {
+        return false;
+    }
+    // Build parent with the ordered child
+    let with_ordered =
+        match Arc::clone(parent).with_new_children(vec![Arc::clone(ordered_child)]) {
+            Ok(p) => p,
+            Err(_) => return false,
+        };
+    if with_ordered.pipeline_behavior() == EmissionType::Final {
+        // Parent is blocking even with ordering — no benefit
+        return false;
+    }
+    // Build parent with an unordered child (simulating CoalescePartitionsExec)

Review Comment:
   yeah, it's legecy



##########
datafusion/physical-optimizer/src/enforce_distribution.rs:
##########
@@ -928,6 +928,47 @@ fn add_hash_on_top(
 ///
 /// * `input`: Current node.
 ///
+/// Checks whether preserving the child's ordering enables the parent to
+/// run in streaming mode. Compares the parent's pipeline behavior with
+/// the ordered child vs. an unordered (coalesced) child. If removing the
+/// ordering would cause the parent to switch from streaming to blocking,
+/// keeping the order-preserving variant is beneficial.
+///
+/// Only applicable to single-child operators; returns false for multi-child
+/// operators (e.g. joins) where child substitution semantics are ambiguous.
+fn preserving_order_enables_streaming(
+    parent: &Arc<dyn ExecutionPlan>,
+    ordered_child: &Arc<dyn ExecutionPlan>,
+) -> bool {
+    // Only applicable to single-child operators that maintain input order
+    // (e.g. AggregateExec in PartiallySorted mode). Operators that don't
+    // maintain input order (e.g. SortExec) handle ordering themselves —
+    // preserving SPM for them is unnecessary.
+    if parent.children().len() != 1 {
+        return false;
+    }
+    if !parent.maintains_input_order()[0] {
+        return false;
+    }
+    // Build parent with the ordered child
+    let with_ordered =
+        match Arc::clone(parent).with_new_children(vec![Arc::clone(ordered_child)]) {
+            Ok(p) => p,
+            Err(_) => return false,

Review Comment:
   agree!



-- 
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: github-unsubscribe@datafusion.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org


Re: [PR] Fix/aggregate output ordering streaming [datafusion]

Posted by "xudong963 (via GitHub)" <gi...@apache.org>.
xudong963 commented on PR #21107:
URL: https://github.com/apache/datafusion/pull/21107#issuecomment-4125197296

   @alamb thanks for the review, this PR is not trading parallelism for sortedness, and it does not remove the hash repartition.
   
   The plan still uses the same Hash repartition with the same partition count; the only change is that we keep the order-preserving variant when removing it would cause the parent AggregateExec (in Sorted / PartiallySorted mode) to switch from incremental to blocking execution.


-- 
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: github-unsubscribe@datafusion.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org


Re: [PR] Improvement: keep order-preserving repartitions for streaming aggregates [datafusion]

Posted by "alamb (via GitHub)" <gi...@apache.org>.
alamb commented on PR #21107:
URL: https://github.com/apache/datafusion/pull/21107#issuecomment-5052335604

   > @alamb Will file a ticket soon
   
   Thank you
   
   I filed a ticket to track this:
   - https://github.com/apache/datafusion/issues/23822


-- 
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: github-unsubscribe@datafusion.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org


Re: [PR] Improvement: keep order-preserving repartitions for streaming aggregates [datafusion]

Posted by "niebayes (via GitHub)" <gi...@apache.org>.
niebayes commented on PR #21107:
URL: https://github.com/apache/datafusion/pull/21107#issuecomment-5025160721

   @alamb Will file a ticket soon


-- 
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: github-unsubscribe@datafusion.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org


Re: [PR] Improvement: keep order-preserving repartitions for streaming aggregates [datafusion]

Posted by "alamb (via GitHub)" <gi...@apache.org>.
alamb commented on PR #21107:
URL: https://github.com/apache/datafusion/pull/21107#issuecomment-4129185186

   > The plan still uses the same Hash repartition with the same partition count; the only change is that we keep the order-preserving variant when removing it would cause the parent AggregateExec (in Sorted / PartiallySorted mode) to switch from incremental to blocking execution.
   
   Sounds good to me


-- 
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: github-unsubscribe@datafusion.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org


Re: [PR] Fix/aggregate output ordering streaming [datafusion]

Posted by "alamb (via GitHub)" <gi...@apache.org>.
alamb commented on PR #21107:
URL: https://github.com/apache/datafusion/pull/21107#issuecomment-4118493733

   > Previously, order-preserving variants could be removed when prefer_existing_sort = false or when there was no explicit ordering requirement, even if dropping the ordering would force a parent operator such as AggregateExec to fall back to blocking execution.
   
   I am not sure this is a "bug" necessarily -- more like a tradeoff. I believe the enforce_distribution plan will attempt to increase plan parallelism even if it has to resort by default 
   
   My understanding is that this is what the prefer_existing_sort setting controls 
   ```
   prefer_existing_sort = false
   ```
   
   So if you want plans to keep existing sorts and not increase parallelism in that case, you should set `prefer_existing_sort = true` -- this is what we do in InfluxDB FWIW
   


-- 
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: github-unsubscribe@datafusion.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org


Re: [PR] Improvement: keep order-preserving repartitions for streaming aggregates [datafusion]

Posted by "niebayes (via GitHub)" <gi...@apache.org>.
niebayes commented on PR #21107:
URL: https://github.com/apache/datafusion/pull/21107#issuecomment-5016393397

   @xudong963 @alamb I found this PR also fixed a bug for DataFusion <54.0.0 version.
   
   For a SQL `SELECT DISTINCT host FROM t ORDER BY host LIMIT k`, if the Scan operator declares the output data is sorted by host already, the SortExec (TopK) operator would be pushed down under the AggregateExec(Final) operator, makes the result incorrect.
   
   I have rewritten a bug reproduction:
   
   ```rust
   //! Reproduces a correctness bug where `SortExec: TopK(fetch=N)` is
   //! inserted between the Partial and Final stages of a grouped sorted
   //! aggregate, after a hash repartition destroys the sort order.
   //!
   //! The intermediate TopK counts ROWS, but its input stream still holds
   //! duplicate GROUP keys (one partial group row per round-robin partition
   //! that saw the key). Limiting ROWS is not limiting GROUPS — duplicates
   //! of small keys can evict keys that belong in the global top-N.
   //!
   //! This test constructs the broken plan shape that Datalayers' optimizer
   //! chain produces and verifies that DISTINCT + ORDER BY + LIMIT drops
   //! distinct values.
   
   use std::sync::Arc;
   
   use arrow::array::{AsArray, StringArray, UInt64Array};
   use arrow::compute::concat_batches;
   use arrow::datatypes::{DataType, Field, Schema};
   use arrow::record_batch::RecordBatch;
   use datafusion::catalog::MemTable;
   use datafusion::common::Result;
   use datafusion::execution::context::SessionContext;
   use datafusion::prelude::{SessionConfig, col};
   
   // ── data-loss reproducer ──────────────────────────────────────────
   //
   // When the plan contains a SortExec:TopK(fetch=N) between
   // AggregateExec:FinalPartitioned and RepartitionExec:Hash, the TopK
   // counts partial-group **rows** instead of distinct **groups**.
   // Because the stream after Hash repartition holds one partial-group
   // row per source partition that saw the key, the duplicates of small
   // keys can consume the entire fetch budget before larger keys are
   // reached.  A key that belongs in the global top-N may then be
   // entirely absent from the output.
   //
   // The test below creates many distinct keys and a fetch small enough
   // that the intermediate TopK necessarily drops group keys.
   //
   // Parameters:
   //   source/hash partitions = 2   (TARGET_PARTITIONS)
   //   distinct_keys    = 8         (h00 -- h07)
   //   fetch            = 2         (LIMIT)
   //
   // PartialAgg(lim=2) outputs the two smallest keys per source
   // partition: h00 and h01.  After hash repartition those 2 keys land
   // in 2 partitions.  If they collide on one partition:
   //   2 keys × 2 partial rows each = 4 rows
   //   TopK(fetch=2) keeps h00×2 → h01 is entirely evicted.
   // The query result then contains only h00 instead of the expected
   // h00, h01.
   
   const N_PARTITIONS: usize = 2;
   const N_KEYS: usize = 8;
   const FETCH: usize = 2;
   
   fn bug_data() -> (Arc<Schema>, Vec<Vec<RecordBatch>>) {
       let schema = Arc::new(Schema::new(vec![
           Field::new("host", DataType::Utf8, false),
           Field::new("row", DataType::UInt64, false),
       ]));
   
       let mut partitions: Vec<Vec<RecordBatch>> = vec![vec![]; N_PARTITIONS];
   
       let mut row = 0u64;
       for key in 0..N_KEYS {
           for _ in 0..N_PARTITIONS {
               let host = Arc::new(StringArray::from(vec![format!("h{key:02}")]));
               let row_arr = Arc::new(UInt64Array::from(vec![row]));
               let batch =
                   RecordBatch::try_new(schema.clone(), vec![host, row_arr]).unwrap();
               partitions[row as usize % N_PARTITIONS].push(batch);
               row += 1;
           }
       }
   
       for (i, p) in partitions.iter().enumerate() {
           let merged = concat_batches(&schema, p).unwrap();
           let values: Vec<_> = merged
               .column_by_name("host")
               .unwrap()
               .as_string::<i32>()
               .iter()
               .map(|v| v.unwrap())
               .collect();
           assert!(values.is_sorted(), "partition {i} not sorted: {values:?}");
       }
   
       (schema, partitions)
   }
   
   #[tokio::test]
   async fn distinct_topk_data_loss() -> Result<()> {
       let config = SessionConfig::new().with_target_partitions(N_PARTITIONS);
       let ctx = SessionContext::new_with_config(config);
   
       let (schema, partitions) = bug_data();
   
       let table = MemTable::try_new(schema, partitions)?.with_sort_order(vec![
           vec![
               col("host").sort(true, false)
           ];
           N_PARTITIONS
       ]);
       ctx.register_table("t", Arc::new(table))?;
   
       let sql = format!("SELECT DISTINCT host FROM t ORDER BY host LIMIT {FETCH}");
       let df = ctx.sql(&sql).await?;
   
       // ── Assert on data ───────────────────────────────────────────
       let results = df.collect().await?;
       let hosts: Vec<String> = results
           .iter()
           .flat_map(|b| {
               b.column(0)
                   .as_string::<i32>()
                   .iter()
                   .map(|o| o.unwrap().to_string())
                   .collect::<Vec<_>>()
           })
           .collect();
   
       let expected: Vec<String> = (0..FETCH).map(|i| format!("h{i:02}")).collect();
       assert_eq!(
           hosts, expected,
           "\nTopK counted rows instead of groups.\n\
            got  {hosts:?}\n\
            want {expected:?}\n\
            (partitions={N_PARTITIONS}, keys={N_KEYS}, fetch={FETCH})"
       );
   
       Ok(())
   }
   ```
   
   The test fails on v53.1.0 and passes on v54.0.0. Users using earlier versions should upgrade.


-- 
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: github-unsubscribe@datafusion.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org