Files
Neha PandClaude Opus 4.7 8a4f7ea23b test(query-agent): add 70 match_all sentinel queries for FST rewrite path coverage (#13824)
## Summary

Adds Q1003–Q1072 (70 queries) to
`tests/test-data/query-agent/queries/full_text_search.json`. All
exercise the `match_all` + FST projection rewrite path fixed in #13808,
under diverse plan shapes.

Structural patterns mirror real production customer queries (fan-out
UNION ALL, multi-CTE, CSE-triggering scalar wrappers on the FTS field)
but use **only test-fixture fields and values** — no customer
identifiers.

## Shape coverage

| Family | Range | Count | What it exercises |
|---|---|---|---|
| A. Subquery + `match_all` + GROUP BY | Q1003–Q1012 | 10 | Simple
inline-view aggregations |
| B. CTE with fan-out UNION ALL, `match_all` per branch | Q1013–Q1027 |
15 | Dominant customer pattern (multi-branch UNION + per-branch FTS +
LIKE/regex + outer aggregate) |
| C. CTE + scalar wrapper on `log`
(trim/upper/split_part/regexp_replace/substring/concat/length) +
`match_all` | Q1028–Q1037 | 10 | **CSE-trigger sentinels** — the
wrappers cause DataFusion CSE to insert the intermediate
`ProjectionExec` that #13808 fixes |
| D. Deep multi-CTE + `match_all` + regex/LIKE/CASE combos | Q1038–Q1047
| 10 | Deep plan trees, many projection candidates |
| E. Edge cases (DISTINCT, HAVING, CASE, IN-list) | Q1048–Q1052 | 5 |
Corner combinations |
| F. `match_all` inside JOINs (self-join, LEFT JOIN, cross-stream) |
Q1053–Q1058 | 6 | JOIN builders inject their own projections |
| G. `match_all` + window functions (ROW_NUMBER, RANK, DENSE_RANK,
SUM/COUNT OVER) | Q1059–Q1063 | 5 | Window planning inserts projections
above filter |
| H. Negated `match_all` (NOT, AND NOT, UNION of pos/neg) | Q1064–Q1066
| 3 | Rewriter's negation code path |
| I. Multiple `match_all` in same query (AND, OR, nested) | Q1067–Q1069
| 3 | Two FST fields injected simultaneously |
| J. `histogram` + `match_all` time-series | Q1070–Q1072 | 3 | Common
customer pattern; histogram optimizer + FST rewriter together |

## Verification

- All 70 queries have DuckDB oracle results auto-populated via
`compute_counts.py`.
- Two initial cross-stream JOIN queries (Q1055, Q1058) were rewritten to
disambiguate the FTS field between streams — now they scope `match_all`
inside a per-stream CTE before joining.
- Audit for customer-token leakage (pharma, tomcat, o2_test, usgm,
storenumber, tagname, cash, credit_card, etc.) returns **zero hits**
across Q1003–Q1072.

## Implementation notes

- Added generator script
[tests/test-data/query-agent/gen_q1003_q1052.py](tests/test-data/query-agent/gen_q1003_q1052.py)
alongside existing `gen_q201_q400.py` / `gen_q511_q556.py` convention.
Deterministic regeneration.
- Wide JSON churn across the other 12 category files is
`compute_counts.py` re-baselining expected results against a fresh
`BASE_TS` (`base_ts_override.json` is untracked); tuple-order shuffles
are harmless under `results_mode: rowsort`.
- Coverage is most meaningful under the `remove_filter_with_index_false`
CI leg (added in #13810), where `match_all` actually reaches
`RewriteMatchPhysical`. Under the default flag (`true`), the index
optimizer removes `match_all` before the rewriter runs, masking the bug
path.

## Test plan

- [ ] `api_query_agent / single_node_opt_true` — green
- [ ] `api_query_agent / single_node_opt_false` — green
- [ ] `api_query_agent / remove_filter_with_index_false` — green (this
is the leg that actually validates the rewriter under all 70 shapes)
- [ ] Q1003–Q1072 all pass on both memtable and parquet phases

🤖 Generated with [Claude Code](https://claude.com/claude-code)

---------

Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-08-17 06:42:06 +00:00

3512 lines
89 KiB
JSON

{
"queries": [
{
"id": "Q083",
"sql": "SELECT histogram(_timestamp) AS _time, COUNT(*) AS cnt FROM \"{stream}\" GROUP BY _time ORDER BY _time",
"category": "histogram",
"expected": {
"row_count": 17,
"columns": [
"_time",
"cnt"
],
"note": "Default histogram with COUNT",
"skip_row_count": true,
"assertions": [
{
"type": "value_range",
"column": "cnt",
"min": 0
}
]
},
"time_offset": {
"start_offset": 4919000000,
"end_offset": 5083000000
}
},
{
"id": "Q084",
"sql": "SELECT histogram(_timestamp) AS _time, COUNT(CASE WHEN load_factor > 50.0 THEN 1 END) AS high_load_cnt, COUNT(CASE WHEN load_factor <= 50.0 THEN 1 END) AS low_load_cnt FROM \"{stream}\" GROUP BY _time ORDER BY _time ASC",
"category": "histogram",
"expected": {
"row_count": 17,
"columns": [
"_time",
"high_load_cnt",
"low_load_cnt"
],
"note": "Histogram with conditional COUNT using CASE",
"skip_row_count": true,
"assertions": [
{
"type": "value_range",
"column": "high_load_cnt",
"min": 0
}
]
},
"time_offset": {
"start_offset": 4979000000,
"end_offset": 5143000000
}
},
{
"id": "Q085",
"sql": "SELECT histogram(_timestamp, '1 minute') AS bucket_time, facility_zone, COUNT(*) AS zone_events, ROUND(AVG(throughput_rate), 2) AS avg_tput FROM \"{stream}\" GROUP BY bucket_time, facility_zone ORDER BY bucket_time ASC, facility_zone ASC",
"category": "histogram",
"expected": {
"columns": [
"bucket_time",
"facility_zone",
"zone_events",
"avg_tput"
],
"results": [
[
"2026-08-14T06:29:00",
"ZONE-1",
"1",
"555.0"
],
[
"2026-08-14T06:29:00",
"ZONE-2",
"1",
"190.0"
],
[
"2026-08-14T06:29:00",
"ZONE-3",
"2",
"727.5"
],
[
"2026-08-14T06:29:00",
"ZONE-4",
"1",
"290.0"
],
[
"2026-08-14T06:30:00",
"ZONE-1",
"1",
"900.0"
],
[
"2026-08-14T06:30:00",
"ZONE-2",
"1",
"150.0"
],
[
"2026-08-14T06:30:00",
"ZONE-3",
"1",
"320.0"
],
[
"2026-08-14T06:30:00",
"ZONE-4",
"2",
"315.0"
],
[
"2026-08-14T06:31:00",
"ZONE-1",
"1",
"610.0"
],
[
"2026-08-14T06:31:00",
"ZONE-2",
"1",
"480.0"
],
[
"2026-08-14T06:31:00",
"ZONE-3",
"1",
"610.0"
],
[
"2026-08-14T06:31:00",
"ZONE-4",
"1",
"725.0"
]
],
"results_mode": "rowsort"
},
"time_offset": {
"start_offset": 5039000000,
"end_offset": 5203000000
}
},
{
"id": "Q086",
"sql": "SELECT histogram(_timestamp, '30 seconds') AS bucket, COUNT(*) AS cnt, SUM(item_count) AS items, ROUND(AVG(cell_temp), 2) AS avg_temp, ROUND(AVG(charge_remaining), 2) AS avg_charge FROM \"{stream}\" WHERE operation_mode != 'manual' GROUP BY bucket ORDER BY bucket ASC",
"category": "histogram",
"expected": {
"columns": [
"bucket",
"cnt",
"items",
"avg_temp",
"avg_charge"
],
"results": [
[
"2026-08-14T06:30:00",
"2",
"243",
"32.9",
"50.25"
],
[
"2026-08-14T06:30:30",
"2",
"685",
"22.0",
"82.0"
],
[
"2026-08-14T06:31:00",
"1",
"275",
"24.8",
"88.7"
],
[
"2026-08-14T06:31:30",
"2",
"550",
"36.25",
"19.15"
],
[
"2026-08-14T06:32:00",
"2",
"170",
"29.25",
"49.95"
]
],
"results_mode": "rowsort"
},
"time_offset": {
"start_offset": 5099000000,
"end_offset": 5263000000
}
},
{
"id": "Q087",
"sql": "SELECT histogram(_timestamp, '2 minutes') AS time_window, operation_mode, COUNT(*) FILTER (WHERE load_factor > 50.0) AS high_load_count, COUNT(*) FILTER (WHERE load_factor <= 50.0) AS low_load_count, COUNT(*) AS total FROM \"{stream}\" GROUP BY time_window, operation_mode ORDER BY time_window ASC, operation_mode ASC",
"category": "histogram",
"expected": {
"columns": [
"time_window",
"operation_mode",
"high_load_count",
"low_load_count",
"total"
],
"results": [
[
"2026-08-14T06:30:00",
"auto",
"0",
"2",
"2"
],
[
"2026-08-14T06:30:00",
"hybrid",
"0",
"1",
"1"
],
[
"2026-08-14T06:30:00",
"manual",
"2",
"0",
"2"
],
[
"2026-08-14T06:32:00",
"auto",
"3",
"0",
"3"
],
[
"2026-08-14T06:32:00",
"hybrid",
"1",
"1",
"2"
],
[
"2026-08-14T06:32:00",
"manual",
"3",
"1",
"4"
]
],
"results_mode": "rowsort"
},
"time_offset": {
"start_offset": 5159000000,
"end_offset": 5323000000
}
},
{
"id": "Q088",
"sql": "SELECT histogram(_timestamp, '5 minutes') AS block, sorter_model, COUNT(*) AS samples, ROUND(MIN(throughput_rate), 2) AS floor_tput, ROUND(MAX(throughput_rate), 2) AS ceiling_tput FROM \"{stream}\" GROUP BY block, sorter_model HAVING COUNT(*) >= 2 ORDER BY block ASC, ceiling_tput DESC",
"category": "histogram",
"expected": {
"columns": [
"block",
"sorter_model",
"samples",
"floor_tput",
"ceiling_tput"
],
"results": [
[
"2026-08-14T06:30:00",
"SORT-M3",
"3",
"320.0",
"900.0"
],
[
"2026-08-14T06:30:00",
"SORT-X1",
"4",
"320.0",
"900.0"
],
[
"2026-08-14T06:30:00",
"SORT-Q5",
"2",
"190.0",
"480.0"
],
[
"2026-08-14T06:30:00",
"SORT-A7",
"3",
"190.0",
"480.0"
],
[
"2026-08-14T06:30:00",
"SORT-Z9",
"2",
"150.0",
"290.0"
]
],
"results_mode": "rowsort"
},
"time_offset": {
"start_offset": 5219000000,
"end_offset": 5383000000
}
},
{
"id": "Q089",
"sql": "SELECT histogram(_timestamp) AS time_slot, control_center, COUNT(*) AS events, ROUND(SUM(package_size) * 1.0 / NULLIF(COUNT(*), 0), 2) AS avg_pkg FROM \"{stream}\" WHERE package_size >= 250 GROUP BY time_slot, control_center ORDER BY time_slot ASC, events DESC",
"category": "histogram",
"expected": {
"row_count": 22,
"columns": [
"time_slot",
"control_center",
"events",
"avg_pkg"
],
"note": "Auto-interval histogram + control_center breakdown with package filter",
"skip_row_count": true,
"assertions": [
{
"type": "row_contains",
"match": {
"control_center": "CC-DELTA"
}
},
{
"type": "value_range",
"column": "events",
"min": 0
}
]
},
"time_offset": {
"start_offset": 5279000000,
"end_offset": 5443000000
}
},
{
"id": "Q090",
"sql": "SELECT histogram(_timestamp, '1 minute') AS minute_slot, COUNT(*) AS total_events, COUNT(DISTINCT pallet_id) AS distinct_pallets, COUNT(DISTINCT conveyor_lane) AS distinct_lanes FROM \"{stream}\" GROUP BY minute_slot ORDER BY minute_slot ASC",
"category": "histogram",
"expected": {
"columns": [
"minute_slot",
"total_events",
"distinct_pallets",
"distinct_lanes"
],
"results": [
[
"2026-08-14T06:34:00",
"5",
"5",
"4"
],
[
"2026-08-14T06:35:00",
"5",
"5",
"4"
],
[
"2026-08-14T06:36:00",
"4",
"4",
"4"
]
],
"results_mode": "rowsort"
},
"time_offset": {
"start_offset": 5339000000,
"end_offset": 5503000000
}
},
{
"id": "Q091",
"sql": "SELECT histogram(_timestamp, '3 minutes') AS interval_bucket, conveyor_lane, operation_mode, COUNT(*) AS cnt, ROUND(AVG(scan_attempts), 2) AS avg_scan FROM \"{stream}\" WHERE scan_attempts >= 1 GROUP BY interval_bucket, conveyor_lane, operation_mode ORDER BY interval_bucket ASC, cnt DESC",
"category": "histogram",
"expected": {
"columns": [
"interval_bucket",
"conveyor_lane",
"operation_mode",
"cnt",
"avg_scan"
],
"results": [
[
"2026-08-14T06:33:00",
"LANE-C",
"manual",
"1",
"2.0"
],
[
"2026-08-14T06:33:00",
"LANE-A",
"auto",
"1",
"1.0"
],
[
"2026-08-14T06:33:00",
"LANE-B",
"manual",
"1",
"3.0"
],
[
"2026-08-14T06:33:00",
"LANE-B",
"auto",
"1",
"4.0"
],
[
"2026-08-14T06:33:00",
"LANE-D",
"hybrid",
"1",
"4.0"
],
[
"2026-08-14T06:36:00",
"LANE-C",
"auto",
"2",
"2.5"
],
[
"2026-08-14T06:36:00",
"LANE-D",
"manual",
"1",
"3.0"
],
[
"2026-08-14T06:36:00",
"LANE-A",
"auto",
"1",
"1.0"
],
[
"2026-08-14T06:36:00",
"LANE-A",
"hybrid",
"1",
"2.0"
],
[
"2026-08-14T06:36:00",
"LANE-C",
"manual",
"1",
"1.0"
],
[
"2026-08-14T06:36:00",
"LANE-B",
"auto",
"1",
"5.0"
],
[
"2026-08-14T06:36:00",
"LANE-D",
"hybrid",
"1",
"2.0"
],
[
"2026-08-14T06:36:00",
"LANE-B",
"manual",
"1",
"2.0"
]
],
"results_mode": "rowsort"
},
"time_offset": {
"start_offset": 5399000000,
"end_offset": 5563000000
}
},
{
"id": "Q092",
"sql": "SELECT histogram(_timestamp, '4 minutes') AS window_block, COUNT(*) FILTER (WHERE charge_remaining >= 60.0) AS charged_ops, COUNT(*) FILTER (WHERE charge_remaining < 30.0) AS low_charge_ops, ROUND(AVG(cell_temp) FILTER (WHERE charge_remaining < 30.0), 2) AS low_charge_avg_temp FROM \"{stream}\" GROUP BY window_block ORDER BY window_block ASC",
"category": "histogram",
"expected": {
"columns": [
"window_block",
"charged_ops",
"low_charge_ops",
"low_charge_avg_temp"
],
"results": [
[
"2026-08-14T06:36:00",
"5",
"5",
"27.92"
]
],
"results_mode": "rowsort"
},
"time_offset": {
"start_offset": 5459000000,
"end_offset": 5623000000
}
},
{
"id": "Q093",
"sql": "SELECT histogram(_timestamp, '15 seconds') AS fine_bucket, COUNT(*) AS total, ROUND(AVG(defect_limit), 3) AS avg_defect, ROUND(STDDEV(throughput_rate), 2) AS tput_volatility FROM \"{stream}\" WHERE defect_limit IS NOT NULL AND throughput_rate IS NOT NULL GROUP BY fine_bucket HAVING COUNT(*) > 1 ORDER BY fine_bucket ASC",
"category": "histogram",
"expected": {
"columns": [
"fine_bucket",
"total",
"avg_defect",
"tput_volatility"
],
"results": [
[
"2026-08-14T06:37:00",
"2",
"1.75",
"120.21"
],
[
"2026-08-14T06:38:00",
"2",
"1.9",
"81.32"
],
[
"2026-08-14T06:39:00",
"2",
"3.15",
"187.38"
]
],
"results_mode": "rowsort"
},
"time_offset": {
"start_offset": 5519000000,
"end_offset": 5683000000
}
},
{
"id": "Q166",
"sql": "SELECT (_timestamp - (_timestamp % 3600000000)) AS time_bucket, page_slug, COALESCE(graphql_operation, 'N/A') AS graphql_operation, COALESCE(info_tag, 'N/A') AS info_tag, COALESCE(visitor_session_id, 'N/A') AS visitor_session_id, COUNT(*) AS row_count FROM \"{stream}\" WHERE (graphql_operation = 'verifyPayment') AND (passthrough_flag <> 'true') AND (info_tag IS NULL OR info_tag NOT LIKE '%NonexistentPattern%') GROUP BY page_slug, graphql_operation, info_tag, (_timestamp - (_timestamp % 3600000000)), visitor_session_id HAVING (COUNT(*) > 0) ORDER BY row_count DESC LIMIT 5",
"category": "histogram",
"time_offset": {
"start_offset": 9899000000,
"end_offset": 10063000000
},
"expected": {
"columns": [
"time_bucket",
"page_slug",
"graphql_operation",
"info_tag",
"visitor_session_id",
"row_count"
],
"results": [
[
"1786690800000000",
"itemPage",
"verifyPayment",
"N/A",
"sess_003",
"1"
]
],
"results_mode": "rowsort"
}
},
{
"id": "Q326",
"sql": "SELECT histogram(_timestamp, '2 minutes') AS _time, (CASE WHEN os_platform LIKE '%Android%' THEN 'Android' WHEN os_platform LIKE '%iOS%' OR os_platform LIKE '%iPhone%' THEN 'iOS' ELSE 'Other' END) AS platform, COUNT(*) AS cnt FROM \"{stream}\" WHERE action_category = 'navigation' GROUP BY _time, platform ORDER BY _time ASC",
"category": "histogram",
"time_offset": {
"start_offset": 19499000000,
"end_offset": 19573000000
},
"expected": {
"columns": [
"_time",
"platform",
"cnt"
],
"results": [
[
"2026-08-14T10:30:00",
"Android",
"2"
]
],
"results_mode": "rowsort"
}
},
{
"id": "Q327",
"sql": "SELECT histogram(_timestamp, '2 minutes') AS _time, COUNT(CASE WHEN action_category = 'performanceMetric' AND error_code NOT IN ('E001', 'E003') THEN 1 END) AS clean_metrics, COUNT(*) AS total_events FROM \"{stream}\" WHERE org_name = 'warehouse-east' GROUP BY _time ORDER BY _time ASC",
"category": "histogram",
"time_offset": {
"start_offset": 19559000000,
"end_offset": 19633000000
},
"expected": {
"columns": [
"_time",
"clean_metrics",
"total_events"
],
"results": [
[
"2026-08-14T10:30:00",
"1",
"1"
]
],
"results_mode": "rowsort"
}
},
{
"id": "Q328",
"sql": "SELECT histogram(_timestamp, '2 minutes') AS _time, (100.0 * COUNT(CASE WHEN action_category = 'performanceMetric' AND exception_message LIKE '%Exception%' THEN 1 END) / COUNT(*)) AS error_pct FROM \"{stream}\" WHERE org_name = 'warehouse-east' AND action_category IN ('performanceMetric', 'navigation') GROUP BY _time ORDER BY _time ASC",
"category": "histogram",
"time_offset": {
"start_offset": 19619000000,
"end_offset": 19693000000
},
"expected": {
"columns": [
"_time",
"error_pct"
],
"results": [
[
"2026-08-14T10:32:00",
"100.0"
]
],
"results_mode": "rowsort"
}
},
{
"id": "Q329",
"sql": "SELECT histogram(_timestamp, '2 minutes') AS _time, COUNT(*) AS cnt, os_platform AS breakdown FROM \"{stream}\" WHERE page_slug IN ('itemPage', 'searchPage') AND action_category IN ('navigation') AND os_platform IN ('Mac OS X (iPhone)', 'Android 14') AND org_name IN ('warehouse-south') GROUP BY _time, breakdown ORDER BY _time ASC",
"category": "histogram",
"time_offset": {
"start_offset": 19679000000,
"end_offset": 19753000000
},
"expected": {
"columns": [
"_time",
"cnt",
"breakdown"
],
"results": [
[
"2026-08-14T10:34:00",
"1",
"Android 14"
]
],
"results_mode": "rowsort"
}
},
{
"id": "Q330",
"sql": "SELECT histogram(_timestamp, '2 minutes') AS _time, COUNT(*) AS cnt FROM \"{stream}\" WHERE org_name = 'warehouse-east' AND build_version IS NOT NULL AND device_type IN ('Mobile', 'Computer', 'Tablet') AND page_slug IN ('itemPage', 'cartPage') AND action_category IN ('performanceMetric', 'navigation') GROUP BY _time ORDER BY _time ASC",
"category": "histogram",
"time_offset": {
"start_offset": 19739000000,
"end_offset": 19813000000
},
"expected": {
"columns": [
"_time",
"cnt"
],
"results": [
[
"2026-08-14T10:34:00",
"2"
]
],
"results_mode": "rowsort"
}
},
{
"id": "Q331",
"sql": "SELECT histogram(_timestamp, '2 minutes') AS _time, COUNT(*) AS cnt FROM \"{stream}\" WHERE org_name IN ('warehouse-north', 'warehouse-south', 'warehouse-central') AND build_version NOT IN ('v1.0.0', 'v1.1.2') AND device_type IN ('Mobile', 'Computer') AND page_slug = 'itemPage' AND action_category IN ('performanceMetric', 'navigation', 'interaction') GROUP BY _time ORDER BY _time ASC",
"category": "histogram",
"time_offset": {
"start_offset": 19799000000,
"end_offset": 19873000000
},
"expected": {
"columns": [
"_time",
"cnt"
],
"results": [
[
"2026-08-14T10:34:00",
"1"
],
[
"2026-08-14T10:36:00",
"1"
]
],
"results_mode": "rowsort"
}
},
{
"id": "Q332",
"sql": "SELECT histogram(_timestamp, '2 minutes') AS _time, exception_message, COUNT(*) AS error_count FROM \"{stream}\" WHERE org_name IN ('warehouse-east', 'warehouse-west') AND re_match(os_platform, 'Android|iPhone') AND action_category = 'performanceMetric' AND (exception_message LIKE '%Exception%' OR upstream_error_code LIKE '%UP-E%') GROUP BY _time, exception_message ORDER BY _time ASC",
"category": "histogram",
"time_offset": {
"start_offset": 19859000000,
"end_offset": 19933000000
},
"expected": {
"columns": [
"_time",
"exception_message",
"error_count"
],
"results": [
[
"2026-08-14T10:36:00",
"OverflowException: throughput_rate 999.0 exceeds max capacity",
"1"
]
],
"results_mode": "rowsort"
}
},
{
"id": "Q333",
"sql": "SELECT histogram(_timestamp, '2 minutes') AS _time, (CASE WHEN os_platform LIKE '%Android%' THEN 'Android' WHEN os_platform LIKE '%iOS%' OR os_platform LIKE '%iPhone%' THEN 'iOS' ELSE os_platform END) AS platform, COUNT(CASE WHEN action_category = 'performanceMetric' AND error_code NOT IN ('E002', 'E004') AND exception_message NOT LIKE '%Timeout%' THEN 1 END) AS filtered_count FROM \"{stream}\" WHERE org_name = 'warehouse-east' GROUP BY _time, platform ORDER BY _time ASC",
"category": "histogram",
"time_offset": {
"start_offset": 19919000000,
"end_offset": 19993000000
},
"expected": {
"columns": [
"_time",
"platform",
"filtered_count"
],
"results": [
[
"2026-08-14T10:38:00",
"Android",
"0"
]
],
"results_mode": "rowsort"
}
},
{
"id": "Q334",
"sql": "SELECT histogram(_timestamp, '2 minutes') AS _time, MAX(latency_ms) AS max_latency, COUNT(CASE WHEN latency_ms > 500 THEN 1 END) AS slow_count, COUNT(*) AS total FROM \"{stream}\" WHERE action_category = 'performanceMetric' AND latency_ms > 0 GROUP BY _time ORDER BY _time ASC",
"category": "histogram",
"time_offset": {
"start_offset": 19979000000,
"end_offset": 20053000000
},
"expected": {
"columns": [
"_time",
"max_latency",
"slow_count",
"total"
],
"results": [
[
"2026-08-14T10:38:00",
"1450",
"4",
"6"
]
],
"results_mode": "rowsort"
}
},
{
"id": "Q335",
"sql": "SELECT histogram(_timestamp, '2 minutes') AS _time, COUNT(CASE WHEN action_category = 'performanceMetric' THEN 1 END) AS performance_count, COUNT(CASE WHEN action_category = 'navigation' THEN 1 END) AS navigation_count, COUNT(CASE WHEN action_category = 'interaction' THEN 1 END) AS interaction_count FROM \"{stream}\" WHERE org_name = 'warehouse-east' GROUP BY _time ORDER BY _time ASC",
"category": "histogram",
"time_offset": {
"start_offset": 20039000000,
"end_offset": 20113000000
},
"expected": {
"columns": [
"_time",
"performance_count",
"navigation_count",
"interaction_count"
],
"results": [
[
"2026-08-14T10:38:00",
"1",
"0",
"0"
],
[
"2026-08-14T10:40:00",
"1",
"0",
"0"
]
],
"results_mode": "rowsort"
}
},
{
"id": "Q336",
"sql": "SELECT histogram(_timestamp, '2 minutes') AS _time, COUNT(*) AS cnt, coalesce(page_url, page_slug) AS page FROM \"{stream}\" WHERE action_category = 'navigation' AND org_name = 'warehouse-south' GROUP BY _time, page ORDER BY _time ASC",
"category": "histogram",
"time_offset": {
"start_offset": 20099000000,
"end_offset": 20173000000
},
"expected": {
"columns": [
"_time",
"cnt",
"page"
],
"results": [
[
"2026-08-14T10:40:00",
"2",
"https://shop.example.com/item/1002"
]
],
"results_mode": "rowsort"
}
},
{
"id": "Q337",
"sql": "SELECT histogram(_timestamp, '2 minutes') AS _time, (CASE WHEN char_length(exception_message) > 20 THEN substring(exception_message, 1, 20) || '...' ELSE exception_message END) AS short_error, COUNT(*) AS cnt FROM \"{stream}\" WHERE action_category = 'performanceMetric' AND exception_message IS NOT NULL GROUP BY _time, short_error ORDER BY _time ASC",
"category": "histogram",
"time_offset": {
"start_offset": 20159000000,
"end_offset": 20233000000
},
"expected": {
"columns": [
"_time",
"short_error",
"cnt"
],
"results": [
[
"2026-08-14T10:40:00",
"SecurityException: u...",
"1"
],
[
"2026-08-14T10:40:00",
"ConfigurationExcepti...",
"1"
],
[
"2026-08-14T10:40:00",
"ResourceExhaustedExc...",
"2"
],
[
"2026-08-14T10:42:00",
"NetworkException: co...",
"1"
],
[
"2026-08-14T10:42:00",
"ConfigurationExcepti...",
"1"
]
],
"results_mode": "rowsort"
}
},
{
"id": "Q338",
"sql": "SELECT histogram(_timestamp, '2 minutes') AS _time, approx_percentile_cont(CAST(latency_ms AS FLOAT), 0.95) AS p95_latency, COUNT(*) AS cnt FROM \"{stream}\" WHERE action_category = 'performanceMetric' AND latency_ms > 0 AND page_slug LIKE '%Page%' GROUP BY _time ORDER BY _time ASC",
"category": "histogram",
"time_offset": {
"start_offset": 20219000000,
"end_offset": 20293000000
},
"expected": {
"columns": [
"_time",
"p95_latency",
"cnt"
],
"results": [
[
"2026-08-14T10:42:00",
"1900.0",
"4"
]
],
"results_mode": "rowsort"
}
},
{
"id": "Q339",
"sql": "SELECT histogram(_timestamp, '2 minutes') AS _time, device_type, COUNT(*) AS cnt, COUNT(DISTINCT visitor_session_id) AS users FROM \"{stream}\" WHERE action_category = 'navigation' AND page_slug = 'itemPage' AND device_type IN ('Mobile', 'Computer', 'Tablet') GROUP BY _time, device_type ORDER BY _time ASC",
"category": "histogram",
"time_offset": {
"start_offset": 20279000000,
"end_offset": 20353000000
},
"expected": {
"columns": [
"_time",
"device_type",
"cnt",
"users"
],
"results": [
[
"2026-08-14T10:44:00",
"Mobile",
"1",
"1"
]
],
"results_mode": "rowsort"
}
},
{
"id": "Q340",
"sql": "SELECT histogram(_timestamp, '2 minutes') AS _time, COUNT(*) AS cnt FROM \"{stream}\" WHERE org_name IN ('warehouse-north', 'warehouse-south', 'warehouse-central') AND build_version NOT IN ('v1.0.0', 'v1.2.0') AND device_type IN ('Mobile', 'Computer') AND page_slug IN ('itemPage', 'searchPage', 'checkoutPage') AND action_category NOT IN ('interaction', 'navigation') GROUP BY _time ORDER BY _time ASC",
"category": "histogram",
"time_offset": {
"start_offset": 20339000000,
"end_offset": 20413000000
},
"expected": {
"columns": [
"_time",
"cnt"
],
"results": [
[
"2026-08-14T10:44:00",
"1"
]
],
"results_mode": "rowsort"
}
},
{
"id": "Q341",
"sql": "SELECT histogram(_timestamp, '2 minutes') AS _time, error_code, COUNT(*) AS cnt FROM \"{stream}\" WHERE action_category = 'performanceMetric' AND error_code IS NOT NULL AND error_code IN ('E001', 'E003', 'E005', 'E002', 'E004') GROUP BY _time, error_code ORDER BY _time ASC",
"category": "histogram",
"time_offset": {
"start_offset": 20399000000,
"end_offset": 20473000000
},
"expected": {
"columns": [
"_time",
"error_code",
"cnt"
],
"results": [
[
"2026-08-14T10:44:00",
"E005",
"2"
],
[
"2026-08-14T10:44:00",
"E004",
"1"
]
],
"results_mode": "rowsort"
}
},
{
"id": "Q342",
"sql": "SELECT histogram(_timestamp, '2 minutes') AS _time, COUNT(*) AS cnt FROM \"{stream}\" WHERE org_name = 'warehouse-east' AND build_version IS NOT NULL AND device_type IN ('Mobile', 'Computer', 'Tablet') AND page_slug IN ('itemPage', 'cartPage') AND action_category IN ('performanceMetric', 'navigation') AND error_code NOT IN ('E002', 'E004') AND visitor_session_id IS NOT NULL GROUP BY _time ORDER BY _time ASC",
"category": "histogram",
"time_offset": {
"start_offset": 20459000000,
"end_offset": 20533000000
},
"expected": {
"columns": [
"_time",
"cnt"
],
"results": [
[
"2026-08-14T10:46:00",
"1"
]
],
"results_mode": "rowsort"
}
},
{
"id": "Q343",
"sql": "SELECT histogram(_timestamp, '2 minutes') AS _time, component_name, COUNT(*) AS cnt, AVG(CAST(latency_ms AS FLOAT)) AS avg_latency FROM \"{stream}\" WHERE action_category = 'performanceMetric' AND latency_ms > 0 GROUP BY _time, component_name ORDER BY _time ASC",
"category": "histogram",
"time_offset": {
"start_offset": 20519000000,
"end_offset": 20593000000
},
"expected": {
"columns": [
"_time",
"component_name",
"cnt",
"avg_latency"
],
"results": [
[
"2026-08-14T10:46:00",
"track-router",
"1",
"230.0"
],
[
"2026-08-14T10:46:00",
"zone-controller",
"2",
"12.0"
],
[
"2026-08-14T10:48:00",
"track-router",
"1",
"230.0"
],
[
"2026-08-14T10:48:00",
"batch-sync",
"1",
"1450.0"
]
],
"results_mode": "rowsort"
}
},
{
"id": "Q344",
"sql": "SELECT histogram(_timestamp, '5 minutes') AS _time, COUNT(*) AS cnt, COUNT(DISTINCT visitor_session_id) AS users FROM \"{stream}\" WHERE org_name = 'warehouse-east' GROUP BY _time ORDER BY _time ASC",
"category": "histogram",
"time_offset": {
"start_offset": 20579000000,
"end_offset": 20653000000
},
"expected": {
"columns": [
"_time",
"cnt",
"users"
],
"results": [
[
"2026-08-14T10:45:00",
"2",
"1"
]
],
"results_mode": "rowsort"
}
},
{
"id": "Q345",
"sql": "SELECT histogram(_timestamp, '2 minutes') AS _time, (CASE WHEN os_platform LIKE '%Android%' THEN 'Android' WHEN os_platform LIKE '%iOS%' OR os_platform LIKE '%iPhone%' THEN 'iOS' ELSE os_platform END) AS platform, page_slug, COUNT(*) AS cnt FROM \"{stream}\" WHERE org_name = 'warehouse-east' AND page_slug IN ('itemPage', 'cartPage', 'searchPage') GROUP BY _time, platform, page_slug ORDER BY _time ASC",
"category": "histogram",
"time_offset": {
"start_offset": 20639000000,
"end_offset": 20713000000
},
"expected": {
"columns": [
"_time",
"platform",
"page_slug",
"cnt"
],
"results": [
[
"2026-08-14T10:48:00",
"Android",
"itemPage",
"1"
],
[
"2026-08-14T10:50:00",
"Android",
"itemPage",
"1"
]
],
"results_mode": "rowsort"
}
},
{
"id": "Q346",
"sql": "SELECT histogram(_timestamp, '2 minutes') AS _time, COUNT(*) AS cnt FROM \"{stream}\" WHERE exception_message LIKE '%Exception%' OR upstream_error_code LIKE '%UP-E%' OR error_code LIKE '%E00%' GROUP BY _time ORDER BY _time ASC",
"category": "histogram",
"time_offset": {
"start_offset": 20699000000,
"end_offset": 20773000000
},
"expected": {
"columns": [
"_time",
"cnt"
],
"results": [
[
"2026-08-14T10:50:00",
"7"
]
],
"results_mode": "rowsort"
}
},
{
"id": "Q347",
"sql": "SELECT histogram(_timestamp, '2 minutes') AS _time, response_code, COUNT(*) AS cnt FROM \"{stream}\" WHERE action_category = 'performanceMetric' AND response_code > 0 GROUP BY _time, response_code ORDER BY _time ASC",
"category": "histogram",
"time_offset": {
"start_offset": 20759000000,
"end_offset": 20833000000
},
"expected": {
"columns": [
"_time",
"response_code",
"cnt"
],
"results": [
[
"2026-08-14T10:50:00",
"500",
"2"
],
[
"2026-08-14T10:50:00",
"503",
"1"
],
[
"2026-08-14T10:50:00",
"401",
"1"
],
[
"2026-08-14T10:52:00",
"403",
"1"
],
[
"2026-08-14T10:52:00",
"401",
"1"
]
],
"results_mode": "rowsort"
}
},
{
"id": "Q348",
"sql": "SELECT histogram(_timestamp, '2 minutes') AS _time, tag_a, COUNT(*) AS cnt, COUNT(DISTINCT visitor_session_id) AS users FROM \"{stream}\" WHERE action_category = 'navigation' AND tag_a IN ('prod', 'staging') GROUP BY _time, tag_a ORDER BY _time ASC",
"category": "histogram",
"time_offset": {
"start_offset": 20819000000,
"end_offset": 20893000000
},
"expected": {
"columns": [
"_time",
"tag_a",
"cnt",
"users"
],
"results": [
[
"2026-08-14T10:52:00",
"staging",
"2",
"1"
]
],
"results_mode": "rowsort"
}
},
{
"id": "Q349",
"sql": "SELECT histogram(_timestamp, '1 minutes') AS _time, (CASE WHEN latency_ms < 100 THEN 'fast' WHEN latency_ms < 500 THEN 'medium' ELSE 'slow' END) AS speed, COUNT(*) AS cnt FROM \"{stream}\" WHERE action_category = 'performanceMetric' AND latency_ms > 0 GROUP BY _time, speed ORDER BY _time ASC",
"category": "histogram",
"time_offset": {
"start_offset": 20879000000,
"end_offset": 20953000000
},
"expected": {
"columns": [
"_time",
"speed",
"cnt"
],
"results": [
[
"2026-08-14T10:53:00",
"slow",
"2"
],
[
"2026-08-14T10:53:00",
"fast",
"1"
],
[
"2026-08-14T10:54:00",
"fast",
"1"
]
],
"results_mode": "rowsort"
}
},
{
"id": "Q350",
"sql": "SELECT histogram(_timestamp, '2 minutes') AS _time, COUNT(*) AS cnt FROM \"{stream}\" WHERE org_name = 'warehouse-east' GROUP BY _time ORDER BY _time ASC",
"category": "histogram",
"time_offset": {
"start_offset": 20939000000,
"end_offset": 21013000000
},
"expected": {
"columns": [
"_time",
"cnt"
],
"results": [
[
"2026-08-14T10:54:00",
"2"
]
],
"results_mode": "rowsort"
}
},
{
"id": "Q471",
"sql": "SELECT histogram(_timestamp, '2 minutes') AS _time, org_name, COUNT(*) AS cnt FROM \"{stream}\" WHERE org_name IS NOT NULL GROUP BY _time, org_name ORDER BY _time ASC, org_name ASC",
"category": "histogram",
"time_offset": {
"start_offset": 28199000000,
"end_offset": 28273000000
},
"expected": {
"columns": [
"_time",
"org_name",
"cnt"
],
"results": [
[
"2026-08-14T12:54:00",
"warehouse-east",
"1"
],
[
"2026-08-14T12:54:00",
"warehouse-north",
"1"
],
[
"2026-08-14T12:54:00",
"warehouse-south",
"1"
],
[
"2026-08-14T12:54:00",
"warehouse-west",
"2"
],
[
"2026-08-14T12:56:00",
"warehouse-central",
"1"
],
[
"2026-08-14T12:56:00",
"warehouse-south",
"1"
]
],
"results_mode": "rowsort"
}
},
{
"id": "Q472",
"sql": "SELECT histogram(_timestamp, '1 minutes') AS _time, device_type, COUNT(*) AS cnt, COUNT(DISTINCT visitor_session_id) AS users FROM \"{stream}\" WHERE action_category = 'performanceMetric' GROUP BY _time, device_type ORDER BY _time ASC, device_type ASC",
"category": "histogram",
"time_offset": {
"start_offset": 28259000000,
"end_offset": 28333000000
},
"expected": {
"columns": [
"_time",
"device_type",
"cnt",
"users"
],
"results": [
[
"2026-08-14T12:56:00",
"Mobile",
"1",
"1"
],
[
"2026-08-14T12:57:00",
"Tablet",
"1",
"1"
]
],
"results_mode": "rowsort"
}
},
{
"id": "Q473",
"sql": "SELECT histogram(_timestamp, '2 minutes') AS _time, (CASE WHEN response_code < 400 THEN 'success' ELSE 'error' END) AS outcome, COUNT(*) AS cnt FROM \"{stream}\" WHERE action_category = 'performanceMetric' GROUP BY _time, outcome ORDER BY _time ASC, outcome ASC",
"category": "histogram",
"time_offset": {
"start_offset": 28319000000,
"end_offset": 28393000000
},
"expected": {
"columns": [
"_time",
"outcome",
"cnt"
],
"results": [
[
"2026-08-14T12:56:00",
"error",
"3"
],
[
"2026-08-14T12:58:00",
"error",
"2"
]
],
"results_mode": "rowsort"
}
},
{
"id": "Q474",
"sql": "SELECT histogram(_timestamp, '5 minutes') AS _time, COUNT(*) AS cnt FROM \"{stream}\" WHERE action_category = 'interaction' GROUP BY _time ORDER BY _time ASC",
"category": "histogram",
"time_offset": {
"start_offset": 28379000000,
"end_offset": 28453000000
},
"expected": {
"columns": [
"_time",
"cnt"
],
"results": [
[
"2026-08-14T12:55:00",
"1"
]
],
"results_mode": "rowsort"
}
},
{
"id": "Q475",
"sql": "SELECT histogram(_timestamp, '1 minutes') AS _time, action_subcategory, ROUND(AVG(CAST(latency_ms AS FLOAT)), 1) AS avg_lat, COUNT(*) AS cnt FROM \"{stream}\" WHERE latency_ms > 0 AND action_subcategory IS NOT NULL GROUP BY _time, action_subcategory ORDER BY _time ASC, cnt DESC",
"category": "histogram",
"time_offset": {
"start_offset": 28439000000,
"end_offset": 28513000000
},
"expected": {
"columns": [
"_time",
"action_subcategory",
"avg_lat",
"cnt"
],
"results": [
[
"2026-08-14T12:59:00",
"vitalsInp",
"2766.7",
"3"
],
[
"2026-08-14T12:59:00",
"vitalsLcp",
"322.5",
"2"
],
[
"2026-08-14T13:00:00",
"vitalsCls",
"15.0",
"1"
],
[
"2026-08-14T13:00:00",
"vitalsInp",
"1900.0",
"1"
]
],
"results_mode": "rowsort"
}
},
{
"id": "Q476",
"sql": "SELECT histogram(_timestamp, '2 minutes') AS _time, page_slug, MIN(CAST(latency_ms AS FLOAT)) AS min_lat, MAX(CAST(latency_ms AS FLOAT)) AS max_lat FROM \"{stream}\" WHERE latency_ms > 0 AND page_slug IS NOT NULL GROUP BY _time, page_slug ORDER BY _time ASC, min_lat ASC",
"category": "histogram",
"time_offset": {
"start_offset": 28499000000,
"end_offset": 28573000000
},
"expected": {
"columns": [
"_time",
"page_slug",
"min_lat",
"max_lat"
],
"results": [
[
"2026-08-14T13:00:00",
"itemPage",
"12.0",
"1900.0"
],
[
"2026-08-14T13:00:00",
"searchPage",
"15.0",
"230.0"
]
],
"results_mode": "rowsort"
}
},
{
"id": "Q477",
"sql": "SELECT histogram(_timestamp, '1 minutes') AS _time, COUNT(*) AS total, COUNT(CASE WHEN error_code IS NOT NULL THEN 1 END) AS errors FROM \"{stream}\" WHERE action_category = 'performanceMetric' GROUP BY _time ORDER BY _time ASC",
"category": "histogram",
"time_offset": {
"start_offset": 28559000000,
"end_offset": 28633000000
},
"expected": {
"columns": [
"_time",
"total",
"errors"
],
"results": [
[
"2026-08-14T13:01:00",
"4",
"4"
],
[
"2026-08-14T13:02:00",
"2",
"2"
]
],
"results_mode": "rowsort"
}
},
{
"id": "Q478",
"sql": "SELECT histogram(_timestamp, '2 minutes') AS _time, guard_mode, COUNT(*) AS cnt, COUNT(DISTINCT component_name) AS components FROM \"{stream}\" WHERE guard_mode IS NOT NULL GROUP BY _time, guard_mode ORDER BY _time ASC, guard_mode ASC",
"category": "histogram",
"time_offset": {
"start_offset": 28619000000,
"end_offset": 28693000000
},
"expected": {
"columns": [
"_time",
"guard_mode",
"cnt",
"components"
],
"results": [
[
"2026-08-14T13:02:00",
"active",
"2",
"2"
],
[
"2026-08-14T13:02:00",
"disabled",
"1",
"1"
],
[
"2026-08-14T13:02:00",
"passive",
"4",
"2"
]
],
"results_mode": "rowsort"
}
},
{
"id": "Q527",
"sql": "SELECT histogram(_timestamp, '1 minute') AS _time, COUNT(*) AS cnt FROM \"{stream}\" GROUP BY _time ORDER BY _time ASC",
"category": "histogram",
"time_offset": {
"start_offset": 31559000000,
"end_offset": 31723000000
},
"expected": {
"columns": [
"_time",
"cnt"
],
"results": [
[
"2026-08-14T13:51:00",
"5"
],
[
"2026-08-14T13:52:00",
"5"
],
[
"2026-08-14T13:53:00",
"4"
]
],
"results_mode": "rowsort"
}
},
{
"id": "Q528",
"sql": "SELECT histogram(_timestamp, '30 second') AS _time, component_name, COUNT(*) AS cnt FROM \"{stream}\" GROUP BY _time, component_name ORDER BY _time ASC, cnt DESC LIMIT 20",
"category": "histogram",
"time_offset": {
"start_offset": 31619000000,
"end_offset": 31783000000
},
"expected": {
"columns": [
"_time",
"component_name",
"cnt"
],
"results": [
[
"2026-08-14T13:52:00",
"lane-monitor",
"2"
],
[
"2026-08-14T13:52:00",
"pallet-mapper",
"1"
],
[
"2026-08-14T13:52:30",
"temp-regulator",
"1"
],
[
"2026-08-14T13:52:30",
"charge-checker",
"1"
],
[
"2026-08-14T13:53:00",
"sorter-engine",
"2"
],
[
"2026-08-14T13:53:00",
"charge-checker",
"1"
],
[
"2026-08-14T13:53:30",
"zone-controller",
"1"
],
[
"2026-08-14T13:53:30",
"conveyor-driver",
"1"
],
[
"2026-08-14T13:54:00",
"scan-hub",
"2"
],
[
"2026-08-14T13:54:00",
"zone-controller",
"1"
],
[
"2026-08-14T13:54:30",
"track-router",
"1"
]
],
"results_mode": "rowsort"
}
},
{
"id": "Q529",
"sql": "SELECT histogram(_timestamp, '1 minute') AS _time, COALESCE(scan_category, 'unknown') AS scan_type, COUNT(*) AS cnt, AVG(CAST(latency_ms AS FLOAT)) AS avg_latency FROM \"{stream}\" GROUP BY _time, scan_type ORDER BY _time ASC, cnt DESC",
"category": "histogram",
"time_offset": {
"start_offset": 31679000000,
"end_offset": 31843000000
},
"expected": {
"columns": [
"_time",
"scan_type",
"cnt",
"avg_latency"
],
"results": [
[
"2026-08-14T13:53:00",
"internal",
"2",
"1900.0"
],
[
"2026-08-14T13:53:00",
"inbound",
"2",
"13.5"
],
[
"2026-08-14T13:53:00",
"outbound",
"1",
"78.0"
],
[
"2026-08-14T13:54:00",
"outbound",
"2",
"45.0"
],
[
"2026-08-14T13:54:00",
"inbound",
"2",
"731.0"
],
[
"2026-08-14T13:54:00",
"internal",
"1",
"230.0"
],
[
"2026-08-14T13:55:00",
"outbound",
"2",
"89.0"
],
[
"2026-08-14T13:55:00",
"inbound",
"1",
"1450.0"
],
[
"2026-08-14T13:55:00",
"internal",
"1",
"567.0"
]
],
"results_mode": "rowsort"
}
},
{
"id": "Q530",
"sql": "SELECT histogram(_timestamp, '1 minute') AS _time, COUNT(*) FILTER (WHERE response_code >= 400) AS error_count, COUNT(*) FILTER (WHERE response_code < 400) AS success_count, COUNT(*) AS total FROM \"{stream}\" GROUP BY _time ORDER BY _time ASC",
"category": "histogram",
"time_offset": {
"start_offset": 31739000000,
"end_offset": 31903000000
},
"expected": {
"columns": [
"_time",
"error_count",
"success_count",
"total"
],
"results": [
[
"2026-08-14T13:54:00",
"5",
"0",
"5"
],
[
"2026-08-14T13:55:00",
"4",
"1",
"5"
],
[
"2026-08-14T13:56:00",
"0",
"4",
"4"
]
],
"results_mode": "rowsort"
}
},
{
"id": "Q531",
"sql": "SELECT histogram(_timestamp, '1 minute') AS _time, SUM(CASE WHEN CAST(latency_ms AS FLOAT) > 500 THEN 1 ELSE 0 END) AS slow_count, SUM(CASE WHEN CAST(latency_ms AS FLOAT) <= 500 THEN 1 ELSE 0 END) AS fast_count FROM \"{stream}\" GROUP BY _time ORDER BY _time ASC",
"category": "histogram",
"time_offset": {
"start_offset": 31799000000,
"end_offset": 31963000000
},
"expected": {
"columns": [
"_time",
"slow_count",
"fast_count"
],
"results": [
[
"2026-08-14T13:55:00",
"3",
"2"
],
[
"2026-08-14T13:56:00",
"2",
"3"
],
[
"2026-08-14T13:57:00",
"0",
"4"
]
],
"results_mode": "rowsort"
}
},
{
"id": "Q532",
"sql": "SELECT histogram(_timestamp, '1 minute') AS _time, CASE WHEN auth_result = 'pass' THEN 'authenticated' WHEN auth_result = 'fail' THEN 'failed' ELSE 'other' END AS auth_class, COUNT(*) AS cnt FROM \"{stream}\" GROUP BY _time, auth_class ORDER BY _time ASC, cnt DESC",
"category": "histogram",
"time_offset": {
"start_offset": 31859000000,
"end_offset": 32023000000
},
"expected": {
"columns": [
"_time",
"auth_class",
"cnt"
],
"results": [
[
"2026-08-14T13:56:00",
"authenticated",
"3"
],
[
"2026-08-14T13:56:00",
"failed",
"1"
],
[
"2026-08-14T13:56:00",
"other",
"1"
],
[
"2026-08-14T13:57:00",
"authenticated",
"3"
],
[
"2026-08-14T13:57:00",
"other",
"1"
],
[
"2026-08-14T13:57:00",
"failed",
"1"
],
[
"2026-08-14T13:58:00",
"authenticated",
"3"
],
[
"2026-08-14T13:58:00",
"failed",
"1"
]
],
"results_mode": "rowsort"
}
},
{
"id": "Q533",
"sql": "SELECT histogram(_timestamp, '1 minute') AS _time, COALESCE(info_tag, bot_flag) AS tag_info, COUNT(*) AS cnt FROM \"{stream}\" GROUP BY _time, tag_info ORDER BY _time ASC, cnt DESC",
"category": "histogram",
"time_offset": {
"start_offset": 31919000000,
"end_offset": 32083000000
},
"expected": {
"columns": [
"_time",
"tag_info",
"cnt"
],
"results": [
[
"2026-08-14T13:57:00",
"None",
"4"
],
[
"2026-08-14T13:57:00",
"Blocklisted",
"1"
],
[
"2026-08-14T13:58:00",
"None",
"4"
],
[
"2026-08-14T13:58:00",
"verified_bot",
"1"
],
[
"2026-08-14T13:59:00",
"None",
"3"
],
[
"2026-08-14T13:59:00",
"Allowlisted",
"1"
]
],
"results_mode": "rowsort",
"skip_sqllogictest": true,
"skip_row_count": true,
"skip_column_check": true
}
},
{
"id": "Q667",
"sql": "SELECT histogram(_timestamp, '30 second') AS _time, COUNT(*) FILTER (WHERE re_match(log, 'ACK')) AS ack_logs, COUNT(*) FILTER (WHERE re_match(log, 'error')) AS error_logs, COUNT(*) AS total FROM \"{stream}\" GROUP BY _time ORDER BY _time",
"category": "histogram",
"time_offset": {
"start_offset": 39900000000,
"end_offset": 40080000000
},
"expected": {
"columns": [
"_time",
"ack_logs",
"error_logs",
"total"
],
"results": [
[
"2026-08-14T16:10:00",
"1",
"0",
"3"
],
[
"2026-08-14T16:10:30",
"1",
"0",
"2"
],
[
"2026-08-14T16:11:00",
"1",
"0",
"3"
],
[
"2026-08-14T16:11:30",
"1",
"0",
"2"
],
[
"2026-08-14T16:12:00",
"1",
"0",
"3"
],
[
"2026-08-14T16:12:30",
"1",
"0",
"2"
],
[
"2026-08-14T16:13:00",
"1",
"0",
"1"
]
],
"results_mode": "rowsort",
"skip_sqllogictest": true
}
},
{
"id": "Q668",
"sql": "SELECT histogram(_timestamp, '1 minute') AS _time, CASE WHEN re_match(facility_zone, 'ZONE-[1-2]') THEN 'front' ELSE 'back' END AS zone_group, COUNT(*) AS cnt, ROUND(AVG(throughput_rate), 1) AS avg_tput FROM \"{stream}\" GROUP BY _time, zone_group ORDER BY _time, zone_group",
"category": "histogram",
"time_offset": {
"start_offset": 39960000000,
"end_offset": 40140000000
},
"expected": {
"columns": [
"_time",
"zone_group",
"cnt",
"avg_tput"
],
"results": [
[
"2026-08-14T16:11:00",
"back",
"2",
"667.5"
],
[
"2026-08-14T16:11:00",
"front",
"3",
"643.3"
],
[
"2026-08-14T16:12:00",
"back",
"2",
"565.0"
],
[
"2026-08-14T16:12:00",
"front",
"3",
"345.0"
],
[
"2026-08-14T16:13:00",
"back",
"3",
"470.0"
],
[
"2026-08-14T16:13:00",
"front",
"2",
"525.0"
],
[
"2026-08-14T16:14:00",
"front",
"1",
"320.0"
]
],
"results_mode": "rowsort",
"skip_sqllogictest": true
}
},
{
"id": "Q669",
"sql": "SELECT _timestamp - (_timestamp % 30000000) AS bucket, COUNT(*) AS cnt, COUNT(*) FILTER (WHERE re_match(exception_message, 'Exception')) AS exceptions FROM \"{stream}\" GROUP BY bucket ORDER BY bucket",
"category": "histogram",
"time_offset": {
"start_offset": 40020000000,
"end_offset": 40200000000
},
"expected": {
"columns": [
"bucket",
"cnt",
"exceptions"
],
"results": [
[
"1786723920000000",
"3",
"3"
],
[
"1786723950000000",
"2",
"2"
],
[
"1786723980000000",
"3",
"3"
],
[
"1786724010000000",
"2",
"2"
],
[
"1786724040000000",
"3",
"3"
],
[
"1786724070000000",
"2",
"2"
],
[
"1786724100000000",
"1",
"1"
]
],
"results_mode": "rowsort",
"skip_sqllogictest": true
}
},
{
"id": "Q670",
"sql": "SELECT histogram(_timestamp, '2 minute') AS _time, COALESCE(bot_flag, 'unknown') AS is_bot, COUNT(*) AS cnt FROM \"{stream}\" WHERE re_match(COALESCE(action_subcategory, ''), 'vitals|metric|interaction') GROUP BY _time, is_bot ORDER BY _time, is_bot",
"category": "histogram",
"time_offset": {
"start_offset": 40080000000,
"end_offset": 40260000000
},
"expected": {
"columns": [
"_time",
"is_bot",
"cnt"
],
"results": [
[
"2026-08-14T16:12:00",
"unknown",
"4"
],
[
"2026-08-14T16:14:00",
"unknown",
"6"
],
[
"2026-08-14T16:14:00",
"verified_bot",
"1"
],
[
"2026-08-14T16:16:00",
"unknown",
"1"
]
],
"results_mode": "rowsort",
"skip_sqllogictest": true
}
},
{
"id": "Q671",
"sql": "SELECT histogram(_timestamp, '15 second') AS _time, COUNT(*) AS total, ROUND(AVG(throughput_rate), 1) AS avg_tput, ROUND(MAX(throughput_rate), 1) AS max_tput, ROUND(MIN(throughput_rate), 1) AS min_tput FROM \"{stream}\" WHERE re_match(facility_zone, 'ZONE-[1-4]') GROUP BY _time ORDER BY _time",
"category": "histogram",
"time_offset": {
"start_offset": 40140000000,
"end_offset": 40320000000
},
"expected": {
"columns": [
"_time",
"total",
"avg_tput",
"max_tput",
"min_tput"
],
"results": [
[
"2026-08-14T16:14:00",
"2",
"400.0",
"480.0",
"320.0"
],
[
"2026-08-14T16:14:15",
"1",
"480.0",
"480.0",
"480.0"
],
[
"2026-08-14T16:14:30",
"1",
"610.0",
"610.0",
"610.0"
],
[
"2026-08-14T16:14:45",
"1",
"725.0",
"725.0",
"725.0"
],
[
"2026-08-14T16:15:00",
"2",
"782.5",
"840.0",
"725.0"
],
[
"2026-08-14T16:15:15",
"1",
"840.0",
"840.0",
"840.0"
],
[
"2026-08-14T16:15:30",
"1",
"290.0",
"290.0",
"290.0"
],
[
"2026-08-14T16:15:45",
"1",
"555.0",
"555.0",
"555.0"
],
[
"2026-08-14T16:16:00",
"2",
"372.5",
"555.0",
"190.0"
],
[
"2026-08-14T16:16:15",
"1",
"190.0",
"190.0",
"190.0"
],
[
"2026-08-14T16:16:30",
"1",
"900.0",
"900.0",
"900.0"
],
[
"2026-08-14T16:16:45",
"1",
"150.0",
"150.0",
"150.0"
],
[
"2026-08-14T16:17:00",
"1",
"150.0",
"150.0",
"150.0"
]
],
"results_mode": "rowsort",
"skip_sqllogictest": true
}
},
{
"id": "Q901",
"sql": "SELECT histogram(_timestamp, '1 minute') AS _time, COUNT(*) AS cnt FROM \"{stream}\" GROUP BY _time ORDER BY _time ASC",
"category": "histogram",
"time_offset": {
"start_offset": 53999000000,
"end_offset": 54163000000
},
"expected": {
"columns": [
"_time",
"cnt"
],
"results": [
[
"2026-08-14T20:05:00",
"5"
],
[
"2026-08-14T20:06:00",
"5"
],
[
"2026-08-14T20:07:00",
"4"
]
],
"results_mode": "rowsort"
}
},
{
"id": "Q902",
"sql": "SELECT histogram(_timestamp, '30 second') AS _time, facility_zone, COUNT(*) AS cnt FROM \"{stream}\" GROUP BY _time, facility_zone ORDER BY _time ASC, cnt DESC LIMIT 20",
"category": "histogram",
"time_offset": {
"start_offset": 54059000000,
"end_offset": 54223000000
},
"expected": {
"columns": [
"_time",
"facility_zone",
"cnt"
],
"results": [
[
"2026-08-14T20:06:00",
"ZONE-1",
"1"
],
[
"2026-08-14T20:06:00",
"ZONE-2",
"1"
],
[
"2026-08-14T20:06:00",
"ZONE-4",
"1"
],
[
"2026-08-14T20:06:30",
"ZONE-3",
"1"
],
[
"2026-08-14T20:06:30",
"ZONE-4",
"1"
],
[
"2026-08-14T20:07:00",
"ZONE-3",
"1"
],
[
"2026-08-14T20:07:00",
"ZONE-2",
"1"
],
[
"2026-08-14T20:07:00",
"ZONE-1",
"1"
],
[
"2026-08-14T20:07:30",
"ZONE-4",
"1"
],
[
"2026-08-14T20:07:30",
"ZONE-1",
"1"
],
[
"2026-08-14T20:08:00",
"ZONE-3",
"1"
],
[
"2026-08-14T20:08:00",
"ZONE-2",
"1"
],
[
"2026-08-14T20:08:00",
"ZONE-4",
"1"
],
[
"2026-08-14T20:08:30",
"ZONE-1",
"1"
]
],
"results_mode": "rowsort"
}
},
{
"id": "Q903",
"sql": "SELECT histogram(_timestamp, '2 minute') AS _time, COUNT(*) FILTER (WHERE throughput_rate > 300) AS high_rate, COUNT(*) FILTER (WHERE throughput_rate <= 300) AS low_rate, COUNT(*) AS total FROM \"{stream}\" GROUP BY _time ORDER BY _time ASC",
"category": "histogram",
"time_offset": {
"start_offset": 54119000000,
"end_offset": 54283000000
},
"expected": {
"columns": [
"_time",
"high_rate",
"low_rate",
"total"
],
"results": [
[
"2026-08-14T20:06:00",
"4",
"1",
"5"
],
[
"2026-08-14T20:08:00",
"6",
"3",
"9"
]
],
"results_mode": "rowsort"
}
},
{
"id": "Q904",
"sql": "SELECT histogram(_timestamp, '1 minute') AS _time, operation_mode, AVG(throughput_rate) AS avg_rate, MAX(throughput_rate) AS peak_rate FROM \"{stream}\" GROUP BY _time, operation_mode ORDER BY _time ASC, avg_rate DESC LIMIT 15",
"category": "histogram",
"time_offset": {
"start_offset": 54179000000,
"end_offset": 54343000000
},
"expected": {
"columns": [
"_time",
"operation_mode",
"avg_rate",
"peak_rate"
],
"results": [
[
"2026-08-14T20:08:00",
"manual",
"782.5",
"840.0"
],
[
"2026-08-14T20:08:00",
"hybrid",
"610.0",
"610.0"
],
[
"2026-08-14T20:08:00",
"auto",
"507.5",
"725.0"
],
[
"2026-08-14T20:09:00",
"hybrid",
"595.0",
"900.0"
],
[
"2026-08-14T20:09:00",
"auto",
"555.0",
"555.0"
],
[
"2026-08-14T20:09:00",
"manual",
"372.5",
"555.0"
],
[
"2026-08-14T20:10:00",
"manual",
"610.0",
"900.0"
],
[
"2026-08-14T20:10:00",
"auto",
"150.0",
"150.0"
]
],
"results_mode": "rowsort"
}
},
{
"id": "Q905",
"sql": "SELECT histogram(_timestamp, '1 minute') AS _time, COALESCE(scan_category, 'unknown') AS scan_type, AVG(CAST(latency_ms AS FLOAT)) AS avg_lat, COUNT(*) AS cnt FROM \"{stream}\" GROUP BY _time, scan_type ORDER BY _time ASC, cnt DESC LIMIT 15",
"category": "histogram",
"time_offset": {
"start_offset": 54239000000,
"end_offset": 54403000000
},
"expected": {
"columns": [
"_time",
"scan_type",
"avg_lat",
"cnt"
],
"results": [
[
"2026-08-14T20:09:00",
"inbound",
"3200.0",
"2"
],
[
"2026-08-14T20:09:00",
"internal",
"1233.5",
"2"
],
[
"2026-08-14T20:09:00",
"outbound",
"78.0",
"1"
],
[
"2026-08-14T20:10:00",
"inbound",
"14.0",
"3"
],
[
"2026-08-14T20:10:00",
"internal",
"1900.0",
"1"
],
[
"2026-08-14T20:10:00",
"outbound",
"45.0",
"1"
],
[
"2026-08-14T20:11:00",
"internal",
"230.0",
"2"
],
[
"2026-08-14T20:11:00",
"inbound",
"1450.0",
"1"
],
[
"2026-08-14T20:11:00",
"outbound",
"45.0",
"1"
]
],
"results_mode": "rowsort"
}
},
{
"id": "Q906",
"sql": "SELECT histogram(_timestamp, '1 minute') AS _time, component_name, SUM(CASE WHEN response_code >= 400 THEN 1 ELSE 0 END) AS errors, COUNT(*) AS total FROM \"{stream}\" GROUP BY _time, component_name ORDER BY _time ASC, errors DESC LIMIT 15",
"category": "histogram",
"time_offset": {
"start_offset": 54299000000,
"end_offset": 54463000000
},
"expected": {
"columns": [
"_time",
"component_name",
"errors",
"total"
],
"results": [
[
"2026-08-14T20:10:00",
"zone-controller",
"1",
"1"
],
[
"2026-08-14T20:10:00",
"scan-hub",
"1",
"1"
],
[
"2026-08-14T20:10:00",
"sorter-engine",
"0",
"1"
],
[
"2026-08-14T20:10:00",
"conveyor-driver",
"0",
"2"
],
[
"2026-08-14T20:11:00",
"track-router",
"2",
"2"
],
[
"2026-08-14T20:11:00",
"pallet-mapper",
"1",
"1"
],
[
"2026-08-14T20:11:00",
"batch-sync",
"1",
"1"
],
[
"2026-08-14T20:11:00",
"scan-hub",
"1",
"1"
],
[
"2026-08-14T20:12:00",
"lane-monitor",
"2",
"2"
],
[
"2026-08-14T20:12:00",
"pallet-mapper",
"1",
"1"
],
[
"2026-08-14T20:12:00",
"temp-regulator",
"0",
"1"
]
],
"results_mode": "rowsort"
}
},
{
"id": "Q907",
"sql": "SELECT histogram(_timestamp, '1 minute') AS _time, COUNT(*) AS cnt, AVG(CAST(latency_ms AS FLOAT)) AS avg_lat, AVG(CAST(lcp_micros AS FLOAT)) AS avg_lcp FROM \"{stream}\" GROUP BY _time ORDER BY _time ASC",
"category": "histogram",
"time_offset": {
"start_offset": 54359000000,
"end_offset": 54523000000
},
"expected": {
"columns": [
"_time",
"cnt",
"avg_lat",
"avg_lcp"
],
"results": [
[
"2026-08-14T20:11:00",
"5",
"408.8",
"2120000.0"
],
[
"2026-08-14T20:12:00",
"5",
"900.2",
"2520000.0"
],
[
"2026-08-14T20:13:00",
"4",
"973.25",
"1700000.0"
]
],
"results_mode": "rowsort"
}
},
{
"id": "Q908",
"sql": "SELECT histogram(_timestamp, '1 minute') AS _time, CASE WHEN auth_result = 'pass' THEN 'authenticated' WHEN auth_result IN ('fail', 'denied') THEN 'failed' ELSE 'other' END AS auth_class, COUNT(*) AS cnt FROM \"{stream}\" GROUP BY _time, auth_class ORDER BY _time ASC, cnt DESC LIMIT 15",
"category": "histogram",
"time_offset": {
"start_offset": 54419000000,
"end_offset": 54583000000
},
"expected": {
"columns": [
"_time",
"auth_class",
"cnt"
],
"results": [
[
"2026-08-14T20:12:00",
"failed",
"3"
],
[
"2026-08-14T20:12:00",
"authenticated",
"2"
],
[
"2026-08-14T20:13:00",
"failed",
"3"
],
[
"2026-08-14T20:13:00",
"authenticated",
"2"
],
[
"2026-08-14T20:14:00",
"authenticated",
"2"
],
[
"2026-08-14T20:14:00",
"failed",
"2"
]
],
"results_mode": "rowsort"
}
},
{
"id": "Q909",
"sql": "SELECT histogram(_timestamp, '1 minute') AS _time, COALESCE(org_name, site_name) AS tenant, COUNT(*) AS cnt FROM \"{stream}\" GROUP BY _time, tenant ORDER BY _time ASC, cnt DESC LIMIT 15",
"category": "histogram",
"time_offset": {
"start_offset": 54479000000,
"end_offset": 54643000000
},
"expected": {
"columns": [
"_time",
"tenant",
"cnt"
],
"results": [
[
"2026-08-14T20:13:00",
"warehouse-east",
"2"
],
[
"2026-08-14T20:13:00",
"warehouse-west",
"1"
],
[
"2026-08-14T20:13:00",
"warehouse-north",
"1"
],
[
"2026-08-14T20:13:00",
"warehouse-central",
"1"
],
[
"2026-08-14T20:14:00",
"warehouse-south",
"2"
],
[
"2026-08-14T20:14:00",
"warehouse-north",
"1"
],
[
"2026-08-14T20:14:00",
"warehouse-central",
"1"
],
[
"2026-08-14T20:14:00",
"warehouse-east",
"1"
],
[
"2026-08-14T20:15:00",
"warehouse-west",
"2"
],
[
"2026-08-14T20:15:00",
"warehouse-north",
"1"
],
[
"2026-08-14T20:15:00",
"warehouse-east",
"1"
]
],
"results_mode": "rowsort"
}
},
{
"id": "Q910",
"sql": "SELECT histogram(_timestamp, '1 minute') AS _time, SUM(CASE WHEN bot_flag IS NOT NULL THEN 1 ELSE 0 END) AS bot_flagged, SUM(CASE WHEN bot_flag IS NULL THEN 1 ELSE 0 END) AS clean FROM \"{stream}\" GROUP BY _time ORDER BY _time ASC",
"category": "histogram",
"time_offset": {
"start_offset": 54539000000,
"end_offset": 54703000000
},
"expected": {
"columns": [
"_time",
"bot_flagged",
"clean"
],
"results": [
[
"2026-08-14T20:14:00",
"1",
"4"
],
[
"2026-08-14T20:15:00",
"0",
"5"
],
[
"2026-08-14T20:16:00",
"0",
"4"
]
],
"results_mode": "rowsort"
}
},
{
"id": "Q911",
"sql": "SELECT histogram(_timestamp, '1 minute') AS _time, COUNT(*) AS total, SUM(CASE WHEN re_match(COALESCE(exception_message, ''), 'NullPointer|Timeout|Security') THEN 1 ELSE 0 END) AS error_count FROM \"{stream}\" GROUP BY _time ORDER BY _time ASC",
"category": "histogram",
"time_offset": {
"start_offset": 54599000000,
"end_offset": 54763000000
},
"expected": {
"columns": [
"_time",
"total",
"error_count"
],
"results": [
[
"2026-08-14T20:15:00",
"5",
"1"
],
[
"2026-08-14T20:16:00",
"5",
"1"
],
[
"2026-08-14T20:17:00",
"4",
"3"
]
],
"results_mode": "rowsort"
}
},
{
"id": "Q912",
"sql": "SELECT histogram(_timestamp, '2 minute') AS _time, facility_zone, operation_mode, SUM(throughput_rate) AS total_rate FROM \"{stream}\" GROUP BY _time, facility_zone, operation_mode ORDER BY _time ASC, total_rate DESC LIMIT 20",
"category": "histogram",
"time_offset": {
"start_offset": 54659000000,
"end_offset": 54823000000
},
"expected": {
"columns": [
"_time",
"facility_zone",
"operation_mode",
"total_rate"
],
"results": [
[
"2026-08-14T20:16:00",
"ZONE-3",
"hybrid",
"1165.0"
],
[
"2026-08-14T20:16:00",
"ZONE-1",
"manual",
"900.0"
],
[
"2026-08-14T20:16:00",
"ZONE-2",
"manual",
"670.0"
],
[
"2026-08-14T20:16:00",
"ZONE-3",
"manual",
"320.0"
],
[
"2026-08-14T20:16:00",
"ZONE-1",
"auto",
"320.0"
],
[
"2026-08-14T20:16:00",
"ZONE-4",
"auto",
"190.0"
],
[
"2026-08-14T20:16:00",
"ZONE-4",
"hybrid",
"150.0"
],
[
"2026-08-14T20:16:00",
"ZONE-2",
"auto",
"150.0"
],
[
"2026-08-14T20:18:00",
"ZONE-3",
"manual",
"840.0"
],
[
"2026-08-14T20:18:00",
"ZONE-4",
"auto",
"725.0"
],
[
"2026-08-14T20:18:00",
"ZONE-2",
"auto",
"725.0"
],
[
"2026-08-14T20:18:00",
"ZONE-1",
"manual",
"610.0"
]
],
"results_mode": "rowsort"
}
},
{
"id": "Q913",
"sql": "SELECT histogram(_timestamp, '1 minute') AS _time, COUNT(*) AS cnt, AVG(throughput_rate) AS avg_rate, STDDEV(throughput_rate) AS std_rate FROM \"{stream}\" GROUP BY _time ORDER BY _time ASC",
"category": "histogram",
"time_offset": {
"start_offset": 54719000000,
"end_offset": 54883000000
},
"expected": {
"columns": [
"_time",
"cnt",
"avg_rate",
"std_rate"
],
"results": [
[
"2026-08-14T20:17:00",
"5",
"376.0",
"175.29974329701685"
],
[
"2026-08-14T20:18:00",
"5",
"638.0",
"210.84947237306523"
],
[
"2026-08-14T20:19:00",
"4",
"397.5",
"186.39116574201327"
]
],
"results_mode": "rowsort"
}
},
{
"id": "Q914",
"sql": "SELECT histogram(_timestamp, '1 minute') AS _time, region_code, AVG(CAST(latency_ms AS FLOAT)) AS avg_lat, COUNT(*) AS cnt FROM \"{stream}\" WHERE region_code IS NOT NULL GROUP BY _time, region_code ORDER BY _time ASC, cnt DESC LIMIT 15",
"category": "histogram",
"time_offset": {
"start_offset": 54779000000,
"end_offset": 54943000000
},
"expected": {
"columns": [
"_time",
"region_code",
"avg_lat",
"cnt"
],
"results": [
[
"2026-08-14T20:18:00",
"AP-SOUTH",
"1450.0",
"2"
],
[
"2026-08-14T20:18:00",
"AP-EAST",
"89.0",
"1"
],
[
"2026-08-14T20:18:00",
"EU-NORTH",
"230.0",
"1"
],
[
"2026-08-14T20:18:00",
"SA-EAST",
"567.0",
"1"
],
[
"2026-08-14T20:19:00",
"US-CENTRAL",
"3200.0",
"2"
],
[
"2026-08-14T20:19:00",
"EU-CENTRAL",
"78.0",
"1"
],
[
"2026-08-14T20:19:00",
"SA-EAST",
"567.0",
"1"
],
[
"2026-08-14T20:19:00",
"AP-CENTRAL",
"1900.0",
"1"
],
[
"2026-08-14T20:20:00",
"US-EAST",
"15.0",
"2"
],
[
"2026-08-14T20:20:00",
"AP-CENTRAL",
"1900.0",
"1"
],
[
"2026-08-14T20:20:00",
"US-WEST",
"12.0",
"1"
]
],
"results_mode": "rowsort"
}
},
{
"id": "Q915",
"sql": "SELECT histogram(_timestamp, '1 minute') AS _time, tag_b AS severity, COUNT(*) AS cnt, AVG(CAST(latency_ms AS FLOAT)) AS avg_lat FROM \"{stream}\" WHERE latency_ms IS NOT NULL GROUP BY _time, severity ORDER BY _time ASC, cnt DESC LIMIT 15",
"category": "histogram",
"time_offset": {
"start_offset": 54839000000,
"end_offset": 55003000000
},
"expected": {
"columns": [
"_time",
"severity",
"cnt",
"avg_lat"
],
"results": [
[
"2026-08-14T20:19:00",
"low",
"2",
"3200.0"
],
[
"2026-08-14T20:19:00",
"medium",
"1",
"567.0"
],
[
"2026-08-14T20:19:00",
"critical",
"1",
"78.0"
],
[
"2026-08-14T20:19:00",
"high",
"1",
"1900.0"
],
[
"2026-08-14T20:20:00",
"medium",
"2",
"15.0"
],
[
"2026-08-14T20:20:00",
"critical",
"1",
"45.0"
],
[
"2026-08-14T20:20:00",
"high",
"1",
"1900.0"
],
[
"2026-08-14T20:20:00",
"low",
"1",
"12.0"
],
[
"2026-08-14T20:21:00",
"high",
"2",
"230.0"
],
[
"2026-08-14T20:21:00",
"critical",
"2",
"747.5"
]
],
"results_mode": "rowsort"
}
},
{
"id": "Q916",
"sql": "SELECT histogram(_timestamp, '1 minute') AS _time, COALESCE(guard_mode, 'unknown') AS gmode, COUNT(*) AS cnt FROM \"{stream}\" GROUP BY _time, gmode ORDER BY _time ASC, cnt DESC LIMIT 15",
"category": "histogram",
"time_offset": {
"start_offset": 54899000000,
"end_offset": 55063000000
},
"expected": {
"columns": [
"_time",
"gmode",
"cnt"
],
"results": [
[
"2026-08-14T20:20:00",
"active",
"3"
],
[
"2026-08-14T20:20:00",
"disabled",
"1"
],
[
"2026-08-14T20:20:00",
"passive",
"1"
],
[
"2026-08-14T20:21:00",
"active",
"2"
],
[
"2026-08-14T20:21:00",
"passive",
"2"
],
[
"2026-08-14T20:21:00",
"disabled",
"1"
],
[
"2026-08-14T20:22:00",
"passive",
"2"
],
[
"2026-08-14T20:22:00",
"active",
"2"
]
],
"results_mode": "rowsort"
}
},
{
"id": "Q917",
"sql": "SELECT a._time, a.cnt AS cnt_a, b.cnt AS cnt_b FROM (SELECT histogram(_timestamp, '1 minute') AS _time, COUNT(*) AS cnt FROM \"{stream}\" GROUP BY _time) a LEFT JOIN (SELECT histogram(_timestamp, '1 minute') AS _time, COUNT(*) AS cnt FROM \"{stream2}\" GROUP BY _time) b ON a._time = b._time ORDER BY a._time ASC",
"category": "histogram",
"time_offset": {
"start_offset": 54959000000,
"end_offset": 55123000000
},
"expected": {
"columns": [
"_time",
"cnt_a",
"cnt_b"
],
"results": [
[
"2026-08-14T20:21:00",
"5",
"5"
],
[
"2026-08-14T20:22:00",
"5",
"5"
],
[
"2026-08-14T20:23:00",
"4",
"4"
]
],
"results_mode": "rowsort"
}
},
{
"id": "Q918",
"sql": "SELECT histogram(_timestamp, '1 minute') AS _time, COUNT(DISTINCT component_name) AS distinct_comps, COUNT(DISTINCT region_code) AS distinct_regions FROM \"{stream}\" GROUP BY _time ORDER BY _time ASC",
"category": "histogram",
"time_offset": {
"start_offset": 55019000000,
"end_offset": 55183000000
},
"expected": {
"columns": [
"_time",
"distinct_comps",
"distinct_regions"
],
"results": [
[
"2026-08-14T20:22:00",
"4",
"4"
],
[
"2026-08-14T20:23:00",
"4",
"4"
],
[
"2026-08-14T20:24:00",
"3",
"3"
]
],
"results_mode": "rowsort"
}
},
{
"id": "Q919",
"sql": "SELECT histogram(_timestamp, '1 minute') AS _time, SUM(CASE WHEN match_all('warehouse') THEN 1 ELSE 0 END) AS fts_hits, COUNT(*) AS total FROM \"{stream}\" GROUP BY _time ORDER BY _time ASC",
"category": "histogram",
"time_offset": {
"start_offset": 55079000000,
"end_offset": 55243000000
},
"expected": {
"columns": [
"_time",
"fts_hits",
"total"
],
"results": [
[
"2026-08-14T20:23:00",
"5",
"5"
],
[
"2026-08-14T20:24:00",
"5",
"5"
],
[
"2026-08-14T20:25:00",
"4",
"4"
]
],
"results_mode": "rowsort",
"skip_sqllogictest": true,
"skip_row_count": true,
"skip_column_check": true
}
},
{
"id": "Q920",
"sql": "SELECT histogram(_timestamp, '30 second') AS _time, component_name, APPROX_DISTINCT(region_code) AS approx_regions, COUNT(*) AS cnt FROM \"{stream}\" WHERE component_name IS NOT NULL GROUP BY _time, component_name ORDER BY _time ASC, cnt DESC LIMIT 20",
"category": "histogram",
"time_offset": {
"start_offset": 55139000000,
"end_offset": 55303000000
},
"expected": {
"columns": [
"_time",
"component_name",
"approx_regions",
"cnt"
],
"results": [
[
"2026-08-14T20:24:00",
"scan-hub",
"1",
"2"
],
[
"2026-08-14T20:24:00",
"zone-controller",
"1",
"1"
],
[
"2026-08-14T20:24:30",
"batch-sync",
"1",
"1"
],
[
"2026-08-14T20:24:30",
"track-router",
"1",
"1"
],
[
"2026-08-14T20:25:00",
"pallet-mapper",
"1",
"2"
],
[
"2026-08-14T20:25:00",
"batch-sync",
"1",
"1"
],
[
"2026-08-14T20:25:30",
"temp-regulator",
"1",
"1"
],
[
"2026-08-14T20:25:30",
"lane-monitor",
"1",
"1"
],
[
"2026-08-14T20:26:00",
"charge-checker",
"1",
"2"
],
[
"2026-08-14T20:26:00",
"temp-regulator",
"1",
"1"
],
[
"2026-08-14T20:26:30",
"sorter-engine",
"1",
"1"
]
],
"results_mode": "rowsort"
}
},
{
"id": "Q921",
"sql": "SELECT histogram(_timestamp, '1 minute') AS _time, device_type, AVG(CAST(lcp_micros AS FLOAT)) AS avg_lcp, AVG(CAST(cls_score AS FLOAT)) AS avg_cls FROM \"{stream}\" WHERE device_type IS NOT NULL GROUP BY _time, device_type ORDER BY _time ASC, avg_lcp DESC LIMIT 15",
"category": "histogram",
"time_offset": {
"start_offset": 55199000000,
"end_offset": 55363000000
},
"expected": {
"columns": [
"_time",
"device_type",
"avg_lcp",
"avg_cls"
],
"results": [
[
"2026-08-14T20:25:00",
"Computer",
"2800000.0",
"0.05000000074505806"
],
[
"2026-08-14T20:25:00",
"Tablet",
"1500000.0",
"0.05999999865889549"
],
[
"2026-08-14T20:25:00",
"Mobile",
"1500000.0",
"0.21000000461935997"
],
[
"2026-08-14T20:26:00",
"Computer",
"2666666.6666666665",
"0.06333333191772302"
],
[
"2026-08-14T20:26:00",
"Mobile",
"1600000.0",
"0.1849999986588955"
],
[
"2026-08-14T20:27:00",
"Tablet",
"2500000.0",
"0.15000000596046448"
],
[
"2026-08-14T20:27:00",
"Mobile",
"1800000.0",
"0.10000000149011612"
],
[
"2026-08-14T20:27:00",
"Computer",
"1200000.0",
"0.029999999329447746"
]
],
"results_mode": "rowsort"
}
},
{
"id": "Q922",
"sql": "SELECT histogram(_timestamp, '2 minute') AS _time, COUNT(*) FILTER (WHERE response_code >= 400) AS error_cnt, COUNT(*) FILTER (WHERE response_code < 400) AS success_cnt, ROUND(CAST(COUNT(*) FILTER (WHERE response_code >= 400) AS FLOAT) * 100.0 / NULLIF(COUNT(*), 0), 2) AS error_pct FROM \"{stream}\" GROUP BY _time ORDER BY _time ASC",
"category": "histogram",
"time_offset": {
"start_offset": 55259000000,
"end_offset": 55423000000
},
"expected": {
"columns": [
"_time",
"error_cnt",
"success_cnt",
"error_pct"
],
"results": [
[
"2026-08-14T20:26:00",
"4",
"6",
"40.0"
],
[
"2026-08-14T20:28:00",
"4",
"0",
"100.0"
]
],
"results_mode": "rowsort"
}
}
],
"last_query_id": 93
}