You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
use promql_utilities::data_model::KeyByLabelNames;
15
+
use promql_utilities::query_logics::enums::Statistic;
15
16
use sql_utilities::sqlhelper::{SQLSchema,Table};
16
17
use std::collections::{HashMap,HashSet};
17
18
use std::sync::Arc;
@@ -176,6 +177,26 @@ mod tests {
176
177
);
177
178
}
178
179
180
+
#[test]
181
+
fnnested_order_by_limit_is_not_topk(){
182
+
// Outer ORDER BY + LIMIT on a spatial-over-temporal query must not be routed
183
+
// through CountMinSketchWithHeap; the inner temporal SUM is not a flat top-k.
184
+
let template = "SELECT L1, SUM(result) FROM (SELECT SUM(value) AS result FROM cpu_usage WHERE time BETWEEN DATEADD(s, -10, NOW()) AND NOW() GROUP BY L1, L2, L3, L4) sub GROUP BY L1";
185
+
let engine = build_sql_engine(template,1,10);
186
+
187
+
let incoming = "SELECT L1, SUM(result) AS rollup FROM (SELECT SUM(value) AS result FROM cpu_usage WHERE time BETWEEN DATEADD(s, -10, '2025-10-01 00:00:10') AND '2025-10-01 00:00:10' GROUP BY L1, L2, L3, L4) sub GROUP BY L1 ORDER BY rollup DESC LIMIT 10";
0 commit comments