Skip to content

Commit 6068744

Browse files
randylihsiang-c
authored andcommitted
Fix: topk_aggregate benchmark failing (#18502)
## Which issue does this PR close? - Closes #18431 ## Rationale for this change -The trace_id in the result is depended on a random number. I think it's better to remove it from the sql to get a stable result ## What changes are included in this PR? Remove the trace_id from the sql and the assert result ## Are these changes tested? N/A ## Are there any user-facing changes? No
1 parent 72b34d4 commit 6068744

File tree

1 file changed

+15
-15
lines changed

1 file changed

+15
-15
lines changed

datafusion/core/benches/topk_aggregate.rs

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ async fn create_context(
4646
opts.optimizer.enable_topk_aggregation = use_topk;
4747
let ctx = SessionContext::new_with_config(cfg);
4848
let _ = ctx.register_table("traces", mem_table)?;
49-
let sql = format!("select trace_id, max(timestamp_ms) from traces group by trace_id order by max(timestamp_ms) desc limit {limit};");
49+
let sql = format!("select max(timestamp_ms) from traces group by trace_id order by max(timestamp_ms) desc limit {limit};");
5050
let df = ctx.sql(sql.as_str()).await?;
5151
let physical_plan = df.create_physical_plan().await?;
5252
let actual_phys_plan = displayable(physical_plan.as_ref()).indent(true).to_string();
@@ -75,20 +75,20 @@ async fn aggregate(
7575

7676
let actual = format!("{}", pretty_format_batches(&batches)?).to_lowercase();
7777
let expected_asc = r#"
78-
+----------------------------------+--------------------------+
79-
| trace_id | max(traces.timestamp_ms) |
80-
+----------------------------------+--------------------------+
81-
| 5868861a23ed31355efc5200eb80fe74 | 16909009999999 |
82-
| 4040e64656804c3d77320d7a0e7eb1f0 | 16909009999998 |
83-
| 02801bbe533190a9f8713d75222f445d | 16909009999997 |
84-
| 9e31b3b5a620de32b68fefa5aeea57f1 | 16909009999996 |
85-
| 2d88a860e9bd1cfaa632d8e7caeaa934 | 16909009999995 |
86-
| a47edcef8364ab6f191dd9103e51c171 | 16909009999994 |
87-
| 36a3fa2ccfbf8e00337f0b1254384db6 | 16909009999993 |
88-
| 0756be84f57369012e10de18b57d8a2f | 16909009999992 |
89-
| d4d6bf9845fa5897710e3a8db81d5907 | 16909009999991 |
90-
| 3c2cc1abe728a66b61e14880b53482a0 | 16909009999990 |
91-
+----------------------------------+--------------------------+
78+
+--------------------------+
79+
| max(traces.timestamp_ms) |
80+
+--------------------------+
81+
| 16909009999999 |
82+
| 16909009999998 |
83+
| 16909009999997 |
84+
| 16909009999996 |
85+
| 16909009999995 |
86+
| 16909009999994 |
87+
| 16909009999993 |
88+
| 16909009999992 |
89+
| 16909009999991 |
90+
| 16909009999990 |
91+
+--------------------------+
9292
"#
9393
.trim();
9494
if asc {

0 commit comments

Comments
 (0)