Skip to content

Commit aee6ced

Browse files
rluvatonclaude
andcommitted
test: don't rely on output batch count in test_sort_with_streaming_table
SortPreservingMergeStream now forwards the last remaining stream's batches as-is, so the number of output batches is not guaranteed. Concatenate the result batches before comparing values. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
1 parent d7156e6 commit aee6ced

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

datafusion/core/tests/physical_optimizer/enforce_sorting.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2839,10 +2839,11 @@ async fn test_sort_with_streaming_table() -> Result<()> {
28392839
let sql = "SELECT a FROM test_table GROUP BY a ORDER BY a";
28402840
let results = ctx.sql(sql).await?.collect().await?;
28412841

2842-
assert_eq!(results.len(), 1);
2843-
assert_eq!(results[0].num_columns(), 1);
2842+
// The number of output batches is not guaranteed, so concatenate before comparing
2843+
let results = arrow::compute::concat_batches(&results[0].schema(), &results)?;
2844+
assert_eq!(results.num_columns(), 1);
28442845
let expected = create_array!(Int32, vec![1, 2, 3]) as ArrayRef;
2845-
assert_eq!(results[0].column(0), &expected);
2846+
assert_eq!(results.column(0), &expected);
28462847

28472848
Ok(())
28482849
}

0 commit comments

Comments
 (0)