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

2601 lines
70 KiB
JSON

{
"queries": [
{
"id": "Q123",
"sql": "SELECT 'critical' AS charge_tier, COUNT(*) AS cnt FROM \"{stream}\" WHERE charge_remaining < 30.0 GROUP BY 'critical' UNION ALL SELECT 'normal' AS charge_tier, COUNT(*) AS cnt FROM \"{stream}\" WHERE charge_remaining >= 30.0 GROUP BY 'normal' ORDER BY charge_tier ASC",
"category": "union",
"expected": {
"columns": [
"charge_tier",
"cnt"
],
"results": [
[
"critical",
"5"
],
[
"normal",
"9"
]
],
"results_mode": "rowsort"
},
"time_offset": {
"start_offset": 7319000000,
"end_offset": 7483000000
}
},
{
"id": "Q124",
"sql": "SELECT sorter_model, COUNT(*) AS cnt FROM \"{stream}\" WHERE throughput_rate >= 500.0 GROUP BY sorter_model UNION SELECT sorter_model, COUNT(*) AS cnt FROM \"{stream}\" WHERE throughput_rate < 300.0 GROUP BY sorter_model ORDER BY sorter_model ASC",
"category": "union",
"expected": {
"columns": [
"sorter_model",
"cnt"
],
"results": [
[
"SORT-A7",
"1"
],
[
"SORT-A7",
"2"
],
[
"SORT-M3",
"3"
],
[
"SORT-Q5",
"1"
],
[
"SORT-X1",
"3"
],
[
"SORT-Z9",
"2"
]
],
"results_mode": "rowsort"
},
"time_offset": {
"start_offset": 7379000000,
"end_offset": 7543000000
}
},
{
"id": "Q125",
"sql": "SELECT 'fast' AS speed_tier, COUNT(*) AS cnt, ROUND(AVG(throughput_rate), 2) AS avg_tput FROM \"{stream}\" WHERE throughput_rate >= 700.0 UNION ALL SELECT 'medium' AS speed_tier, COUNT(*) AS cnt, ROUND(AVG(throughput_rate), 2) AS avg_tput FROM \"{stream}\" WHERE throughput_rate >= 300.0 AND throughput_rate < 700.0 UNION ALL SELECT 'slow' AS speed_tier, COUNT(*) AS cnt, ROUND(AVG(throughput_rate), 2) AS avg_tput FROM \"{stream}\" WHERE throughput_rate < 300.0 ORDER BY speed_tier ASC",
"category": "union",
"expected": {
"columns": [
"speed_tier",
"cnt",
"avg_tput"
],
"results": [
[
"fast",
"3",
"841.67"
],
[
"medium",
"7",
"515.71"
],
[
"slow",
"4",
"195.0"
]
],
"results_mode": "rowsort"
},
"time_offset": {
"start_offset": 7439000000,
"end_offset": 7603000000
}
},
{
"id": "Q126",
"sql": "SELECT sorter_model, operation_mode, COUNT(*) AS cnt FROM \"{stream}\" GROUP BY sorter_model, operation_mode HAVING COUNT(*) > 0 UNION ALL SELECT NULL AS sorter_model, operation_mode, COUNT(*) AS cnt FROM \"{stream}\" WHERE throughput_rate >= 800.0 GROUP BY operation_mode ORDER BY cnt DESC, sorter_model ASC LIMIT 8",
"category": "union",
"expected": {
"columns": [
"sorter_model",
"operation_mode",
"cnt"
],
"results": [
[
"SORT-A7",
"hybrid",
"2"
],
[
"SORT-A7",
"auto",
"2"
],
[
"SORT-M3",
"auto",
"2"
],
[
"SORT-M3",
"manual",
"2"
],
[
"SORT-X1",
"hybrid",
"2"
],
[
"SORT-Z9",
"manual",
"2"
],
[
"None",
"auto",
"2"
],
[
"SORT-Q5",
"auto",
"1"
]
],
"results_mode": "rowsort"
},
"time_offset": {
"start_offset": 7499000000,
"end_offset": 7663000000
}
},
{
"id": "Q127",
"sql": "SELECT _timestamp, log FROM \"{stream}\" WHERE cell_temp >= 30.0 UNION ALL SELECT _timestamp, log FROM \"{stream}\" WHERE cell_temp < 20.0 ORDER BY _timestamp DESC LIMIT 10",
"category": "union",
"expected": {
"columns": [
"log"
],
"results": [
[
"Q129 warehouse event record 2"
],
[
"Q129 warehouse event record 1"
],
[
"Q128 warehouse event record 4"
],
[
"Q128 warehouse event record 1"
],
[
"Q127 warehouse event record 4"
],
[
"Q128 warehouse event record 0 ACK batch batchIdList:Q128-0"
],
[
"Q127 warehouse event record 3 ACK batch batchIdList:Q127-3"
],
[
"Q127 warehouse event record 2"
]
],
"results_mode": "rowsort",
"skip_sqllogictest": true
},
"time_offset": {
"start_offset": 7559000000,
"end_offset": 7723000000
}
},
{
"id": "Q128",
"sql": "WITH zone_agg AS (SELECT facility_zone AS location, 'zone' AS granularity, COUNT(*) AS total, ROUND(AVG(throughput_rate), 2) AS avg_tput FROM \"{stream}\" GROUP BY facility_zone), center_agg AS (SELECT control_center AS location, 'center' AS granularity, COUNT(*) AS total, ROUND(AVG(throughput_rate), 2) AS avg_tput FROM \"{stream}\" GROUP BY control_center), combined AS (SELECT * FROM zone_agg UNION ALL SELECT * FROM center_agg) SELECT * FROM combined ORDER BY granularity ASC, avg_tput DESC",
"category": "union",
"expected": {
"columns": [
"location",
"granularity",
"total",
"avg_tput"
],
"results": [
[
"CC-BETA",
"center",
"4",
"667.5"
],
[
"CC-DELTA",
"center",
"3",
"591.67"
],
[
"CC-GAMMA",
"center",
"3",
"320.0"
],
[
"CC-ALPHA",
"center",
"4",
"277.5"
],
[
"ZONE-3",
"zone",
"4",
"667.5"
],
[
"ZONE-1",
"zone",
"3",
"591.67"
],
[
"ZONE-4",
"zone",
"3",
"320.0"
],
[
"ZONE-2",
"zone",
"4",
"277.5"
]
],
"results_mode": "rowsort"
},
"time_offset": {
"start_offset": 7619000000,
"end_offset": 7783000000
}
},
{
"id": "Q129",
"sql": "SELECT facility_zone, sorter_model, COUNT(*) AS cnt, MAX(throughput_rate) AS max_tput FROM \"{stream}\" WHERE operation_mode = 'auto' GROUP BY facility_zone, sorter_model UNION SELECT facility_zone, sorter_model, COUNT(*) AS cnt, MAX(throughput_rate) AS max_tput FROM \"{stream}\" WHERE operation_mode = 'hybrid' GROUP BY facility_zone, sorter_model ORDER BY facility_zone ASC, max_tput DESC",
"category": "union",
"expected": {
"columns": [
"facility_zone",
"sorter_model",
"cnt",
"max_tput"
],
"results": [
[
"ZONE-1",
"SORT-M3",
"2",
"900.0"
],
[
"ZONE-2",
"SORT-Q5",
"1",
"480.0"
],
[
"ZONE-3",
"SORT-X1",
"2",
"840.0"
],
[
"ZONE-4",
"SORT-A7",
"2",
"725.0"
],
[
"ZONE-4",
"SORT-A7",
"2",
"480.0"
]
],
"results_mode": "rowsort"
},
"time_offset": {
"start_offset": 7679000000,
"end_offset": 7843000000
}
},
{
"id": "Q130",
"sql": "WITH auto_top AS (SELECT facility_zone, sorter_model, throughput_rate, ROW_NUMBER() OVER (PARTITION BY facility_zone ORDER BY throughput_rate DESC) AS rn FROM \"{stream}\" WHERE operation_mode='auto' AND throughput_rate IS NOT NULL), manual_top AS (SELECT facility_zone, sorter_model, throughput_rate, ROW_NUMBER() OVER (PARTITION BY facility_zone ORDER BY throughput_rate DESC) AS rn FROM \"{stream}\" WHERE operation_mode='manual' AND throughput_rate IS NOT NULL) SELECT facility_zone, sorter_model, throughput_rate, rn, 'auto' AS mode FROM auto_top WHERE rn <= 2 UNION ALL SELECT facility_zone, sorter_model, throughput_rate, rn, 'manual' AS mode FROM manual_top WHERE rn <= 2 ORDER BY mode ASC, facility_zone ASC, rn ASC",
"category": "union",
"expected": {
"columns": [
"facility_zone",
"sorter_model",
"throughput_rate",
"rn",
"mode"
],
"results": [
[
"ZONE-1",
"SORT-M3",
"900.0",
"1",
"auto"
],
[
"ZONE-1",
"SORT-M3",
"840.0",
"2",
"auto"
],
[
"ZONE-2",
"SORT-Q5",
"480.0",
"1",
"auto"
],
[
"ZONE-2",
"SORT-Q5",
"190.0",
"2",
"auto"
],
[
"ZONE-4",
"SORT-A7",
"480.0",
"1",
"auto"
],
[
"ZONE-4",
"SORT-A7",
"290.0",
"2",
"auto"
],
[
"ZONE-1",
"SORT-M3",
"555.0",
"1",
"manual"
],
[
"ZONE-1",
"SORT-M3",
"320.0",
"2",
"manual"
],
[
"ZONE-2",
"SORT-Z9",
"725.0",
"1",
"manual"
],
[
"ZONE-3",
"SORT-X1",
"610.0",
"1",
"manual"
],
[
"ZONE-3",
"SORT-X1",
"555.0",
"2",
"manual"
]
],
"results_mode": "rowsort"
},
"time_offset": {
"start_offset": 7739000000,
"end_offset": 7903000000
}
},
{
"id": "Q131",
"sql": "SELECT _timestamp, pallet_id, facility_zone, load_factor, 'day_shift' AS shift FROM \"{stream}\" WHERE runtime_hours IS NOT NULL AND CAST(FLOOR(CAST(runtime_hours AS FLOAT) / 24.0) AS INTEGER) % 2 = 0 UNION ALL SELECT _timestamp, pallet_id, facility_zone, load_factor, 'night_shift' AS shift FROM \"{stream}\" WHERE runtime_hours IS NOT NULL AND CAST(FLOOR(CAST(runtime_hours AS FLOAT) / 24.0) AS INTEGER) % 2 = 1 ORDER BY shift ASC, load_factor DESC LIMIT 20",
"category": "union",
"expected": {
"columns": [
"pallet_id",
"facility_zone",
"load_factor",
"shift"
],
"results": [
[
"PL-006",
"ZONE-4",
"88.1",
"day_shift"
],
[
"PL-004",
"ZONE-2",
"88.1",
"day_shift"
],
[
"PL-002",
"ZONE-4",
"55.2",
"day_shift"
],
[
"PL-001",
"ZONE-3",
"33.0",
"day_shift"
],
[
"PL-007",
"ZONE-1",
"33.0",
"day_shift"
],
[
"PL-007",
"ZONE-1",
"94.6",
"night_shift"
],
[
"PL-005",
"ZONE-3",
"72.8",
"night_shift"
],
[
"PL-003",
"ZONE-1",
"72.8",
"night_shift"
],
[
"PL-001",
"ZONE-3",
"67.9",
"night_shift"
],
[
"PL-003",
"ZONE-1",
"67.9",
"night_shift"
],
[
"PL-008",
"ZONE-2",
"45.3",
"night_shift"
],
[
"PL-002",
"ZONE-4",
"45.3",
"night_shift"
],
[
"PL-004",
"ZONE-2",
"21.4",
"night_shift"
],
[
"PL-008",
"ZONE-2",
"12.5",
"night_shift"
]
],
"results_mode": "rowsort"
},
"time_offset": {
"start_offset": 7799000000,
"end_offset": 7963000000
}
},
{
"id": "Q132",
"sql": "WITH ranked_all AS (SELECT _timestamp, pallet_id, facility_zone, throughput_rate, ROW_NUMBER() OVER (PARTITION BY facility_zone ORDER BY throughput_rate DESC) AS rn FROM \"{stream}\" WHERE throughput_rate IS NOT NULL) SELECT facility_zone, pallet_id, throughput_rate, rn, 'LEADER' AS label FROM ranked_all WHERE rn = 1 UNION ALL SELECT facility_zone, pallet_id, throughput_rate, rn, 'RUNNER_UP' AS label FROM ranked_all WHERE rn = 2 UNION ALL SELECT facility_zone, pallet_id, throughput_rate, rn, 'TRAILING' AS label FROM ranked_all WHERE rn >= 5 ORDER BY facility_zone ASC, rn ASC",
"category": "union",
"expected": {
"columns": [
"facility_zone",
"pallet_id",
"throughput_rate",
"rn",
"label"
],
"results": [
[
"ZONE-1",
"PL-007",
"900.0",
"1",
"LEADER"
],
[
"ZONE-1",
"PL-007",
"610.0",
"2",
"RUNNER_UP"
],
[
"ZONE-2",
"PL-008",
"725.0",
"1",
"LEADER"
],
[
"ZONE-2",
"PL-004",
"480.0",
"2",
"RUNNER_UP"
],
[
"ZONE-3",
"PL-001",
"840.0",
"1",
"LEADER"
],
[
"ZONE-3",
"PL-005",
"610.0",
"2",
"RUNNER_UP"
],
[
"ZONE-4",
"PL-006",
"725.0",
"1",
"LEADER"
],
[
"ZONE-4",
"PL-006",
"190.0",
"2",
"RUNNER_UP"
]
],
"results_mode": "rowsort"
},
"time_offset": {
"start_offset": 7859000000,
"end_offset": 8023000000
}
},
{
"id": "Q133",
"sql": "SELECT facility_zone, COUNT(*) FILTER (WHERE operation_mode='auto') AS auto_cnt, COUNT(*) FILTER (WHERE operation_mode='manual') AS manual_cnt, ROUND(AVG(throughput_rate) FILTER (WHERE operation_mode='auto'), 2) AS avg_tput_auto, ROUND(AVG(throughput_rate) FILTER (WHERE operation_mode='manual'), 2) AS avg_tput_manual, ROUND(AVG(cell_temp) FILTER (WHERE operation_mode='auto'), 2) AS avg_temp_auto, ROUND(AVG(cell_temp) FILTER (WHERE operation_mode='manual'), 2) AS avg_temp_manual FROM \"{stream}\" GROUP BY facility_zone ORDER BY facility_zone ASC",
"category": "union",
"expected": {
"columns": [
"facility_zone",
"auto_cnt",
"manual_cnt",
"avg_tput_auto",
"avg_tput_manual",
"avg_temp_auto",
"avg_temp_manual"
],
"results": [
[
"ZONE-1",
"1",
"2",
"610.0",
"437.5",
"28.9",
"20.6"
],
[
"ZONE-2",
"2",
"1",
"385.0",
"725.0",
"21.65",
"32.5"
],
[
"ZONE-3",
"0",
"2",
"None",
"582.5",
"None",
"25.45"
],
[
"ZONE-4",
"2",
"0",
"220.0",
"None",
"27.1",
"None"
]
],
"results_mode": "rowsort"
},
"time_offset": {
"start_offset": 7919000000,
"end_offset": 8083000000
}
},
{
"id": "Q134",
"sql": "SELECT CASE WHEN charge_remaining < 35.0 THEN 'low_charge' WHEN charge_remaining BETWEEN 35.0 AND 70.0 THEN 'medium_charge' ELSE 'high_charge' END AS category, COUNT(*) AS cnt, ROUND(AVG(cell_temp), 2) AS avg_temp, ROUND(AVG(throughput_rate), 2) AS avg_tput FROM \"{stream}\" GROUP BY category ORDER BY category ASC",
"category": "union",
"expected": {
"columns": [
"category",
"cnt",
"avg_temp",
"avg_tput"
],
"results": [
[
"high_charge",
"2",
"24.05",
"465.0"
],
[
"low_charge",
"6",
"29.22",
"598.33"
],
[
"medium_charge",
"6",
"28.1",
"446.67"
]
],
"results_mode": "rowsort"
},
"time_offset": {
"start_offset": 7979000000,
"end_offset": 8143000000
}
},
{
"id": "Q158",
"sql": "SELECT '10-20' AS bucket, count(distinct array_extract(regexp_match(event_detail, 'track ([A-Za-z0-9-]+)'), 1)) AS itemcount FROM \"{stream}\" WHERE str_match_ignore_case(event_detail, 'sorter batch') AND app_label != 'tax-prod-b' AND CAST(array_extract(regexp_match(event_detail, 'segment ([0-9]+)'), 1) AS INT) BETWEEN 1 AND 5 UNION ALL SELECT '21-30' AS bucket, count(distinct array_extract(regexp_match(event_detail, 'track ([A-Za-z0-9-]+)'), 1)) AS itemcount FROM \"{stream}\" WHERE str_match_ignore_case(event_detail, 'sorter batch') AND app_label != 'tax-prod-b' AND CAST(array_extract(regexp_match(event_detail, 'segment ([0-9]+)'), 1) AS INT) BETWEEN 6 AND 10",
"category": "union",
"expected": {
"columns": [
"bucket",
"itemcount"
],
"results": [
[
"10-20",
"0"
],
[
"21-30",
"0"
]
],
"results_mode": "rowsort",
"skip_sqllogictest": true
},
"time_offset": {
"start_offset": 9419000000,
"end_offset": 9583000000
}
},
{
"id": "Q197",
"sql": "SELECT facility_zone, 'auto_ops' AS category, COUNT(*) AS cnt, AVG(throughput_rate) AS avg_tput\nFROM \"{stream}\"\nWHERE operation_mode = 'auto' AND load_factor > 20.0\nGROUP BY facility_zone\nUNION\nSELECT facility_zone, 'manual_ops' AS category, COUNT(*) AS cnt, AVG(throughput_rate) AS avg_tput\nFROM \"{stream}\"\nWHERE operation_mode = 'manual' AND load_factor > 20.0\nGROUP BY facility_zone\nUNION\nSELECT facility_zone, 'hybrid_ops' AS category, COUNT(*) AS cnt, AVG(throughput_rate) AS avg_tput\nFROM \"{stream}\"\nWHERE operation_mode = 'hybrid' AND load_factor > 20.0\nGROUP BY facility_zone\nORDER BY category, avg_tput DESC",
"category": "union",
"time_offset": {
"start_offset": 11759000000,
"end_offset": 11923000000
},
"expected": {
"columns": [
"facility_zone",
"category",
"cnt",
"avg_tput"
],
"results": [
[
"ZONE-1",
"auto_ops",
"1",
"840.0"
],
[
"ZONE-4",
"auto_ops",
"2",
"335.0"
],
[
"ZONE-2",
"auto_ops",
"1",
"190.0"
],
[
"ZONE-3",
"hybrid_ops",
"2",
"582.5"
],
[
"ZONE-4",
"hybrid_ops",
"2",
"220.0"
],
[
"ZONE-3",
"manual_ops",
"2",
"870.0"
],
[
"ZONE-1",
"manual_ops",
"2",
"755.0"
],
[
"ZONE-2",
"manual_ops",
"1",
"290.0"
]
],
"results_mode": "rowsort"
}
},
{
"id": "Q198",
"sql": "SELECT region_code, facility_zone,\n COUNT(*) AS cnt,\n AVG(throughput_rate) AS avg_throughput,\n MAX(load_factor) AS max_load\nFROM \"{stream}\"\nWHERE load_factor >= 50.0 AND throughput_rate >= 300.0\nGROUP BY region_code, facility_zone\nUNION ALL\nSELECT region_code, facility_zone,\n COUNT(*) AS cnt,\n AVG(throughput_rate) AS avg_throughput,\n MAX(load_factor) AS max_load\nFROM \"{stream}\"\nWHERE load_factor < 50.0 AND throughput_rate < 300.0\nGROUP BY region_code, facility_zone\nORDER BY avg_throughput DESC\nLIMIT 20",
"category": "union",
"time_offset": {
"start_offset": 11819000000,
"end_offset": 11983000000
},
"expected": {
"columns": [
"region_code",
"facility_zone",
"cnt",
"avg_throughput",
"max_load"
],
"results": [
[
"AP-CENTRAL",
"ZONE-1",
"1",
"900.0",
"94.6"
],
[
"AP-CENTRAL",
"ZONE-3",
"1",
"900.0",
"94.6"
],
[
"EU-NORTH",
"ZONE-1",
"1",
"610.0",
"99.0"
],
[
"US-CENTRAL",
"ZONE-3",
"1",
"555.0",
"72.8"
],
[
"US-WEST",
"ZONE-1",
"1",
"320.0",
"67.9"
],
[
"US-WEST",
"ZONE-3",
"1",
"320.0",
"67.9"
],
[
"US-EAST",
"ZONE-4",
"1",
"150.0",
"45.3"
]
],
"results_mode": "rowsort"
}
},
{
"id": "Q381",
"sql": "SELECT 'item_page' AS source, component_name, COUNT(*) AS cnt FROM \"{stream}\" WHERE page_slug = 'itemPage' AND action_category = 'performanceMetric' GROUP BY component_name UNION ALL SELECT 'cart_page' AS source, component_name, COUNT(*) AS cnt FROM \"{stream}\" WHERE page_slug = 'cartPage' AND action_category = 'performanceMetric' GROUP BY component_name UNION ALL SELECT 'search_page' AS source, component_name, COUNT(*) AS cnt FROM \"{stream}\" WHERE page_slug = 'searchPage' AND action_category = 'performanceMetric' GROUP BY component_name",
"category": "union",
"time_offset": {
"start_offset": 22799000000,
"end_offset": 22873000000
},
"expected": {
"columns": [
"source",
"component_name",
"cnt"
],
"results": [
[
"item_page",
"pallet-mapper",
"2"
],
[
"cart_page",
"batch-sync",
"1"
]
],
"results_mode": "rowsort"
}
},
{
"id": "Q382",
"sql": "SELECT 'Android' AS platform, page_slug, COUNT(*) AS cnt FROM \"{stream}\" WHERE os_platform LIKE '%Android%' AND action_category = 'navigation' GROUP BY page_slug UNION ALL SELECT 'iOS' AS platform, page_slug, COUNT(*) AS cnt FROM \"{stream}\" WHERE (os_platform LIKE '%iOS%' OR os_platform LIKE '%iPhone%') AND action_category = 'navigation' GROUP BY page_slug UNION ALL SELECT 'Other' AS platform, page_slug, COUNT(*) AS cnt FROM \"{stream}\" WHERE os_platform NOT LIKE '%Android%' AND os_platform NOT LIKE '%iOS%' AND os_platform NOT LIKE '%iPhone%' AND action_category = 'navigation' GROUP BY page_slug",
"category": "union",
"time_offset": {
"start_offset": 22859000000,
"end_offset": 22933000000
},
"expected": {
"columns": [
"platform",
"page_slug",
"cnt"
],
"results": [
[
"iOS",
"homePage",
"2"
]
],
"results_mode": "rowsort"
}
},
{
"id": "Q383",
"sql": "SELECT coalesce(page_url, page_slug) AS source, COUNT(*) AS cnt FROM \"{stream}\" WHERE action_category = 'navigation' AND page_slug = 'itemPage' GROUP BY source UNION ALL SELECT coalesce(page_url, page_slug) AS source, COUNT(*) AS cnt FROM \"{stream}\" WHERE action_category = 'navigation' AND page_slug = 'cartPage' GROUP BY source",
"category": "union",
"time_offset": {
"start_offset": 22919000000,
"end_offset": 22993000000
},
"expected": {
"columns": [
"source",
"cnt"
],
"results": [
[
"https://shop.example.com/item/1002",
"1"
]
],
"results_mode": "rowsort"
}
},
{
"id": "Q384",
"sql": "SELECT 'east' AS region, error_code, COUNT(*) AS cnt FROM \"{stream}\" WHERE org_name = 'warehouse-east' AND action_category = 'performanceMetric' AND error_code IS NOT NULL GROUP BY error_code UNION ALL SELECT 'west' AS region, error_code, COUNT(*) AS cnt FROM \"{stream}\" WHERE org_name = 'warehouse-west' AND action_category = 'performanceMetric' AND error_code IS NOT NULL GROUP BY error_code",
"category": "union",
"time_offset": {
"start_offset": 22979000000,
"end_offset": 23053000000
},
"expected": {
"columns": [
"region",
"error_code",
"cnt"
],
"results": [
[
"east",
"E004",
"2"
],
[
"west",
"E005",
"1"
]
],
"results_mode": "rowsort"
}
},
{
"id": "Q385",
"sql": "SELECT 'mobile' AS device_class, action_category, COUNT(*) AS cnt FROM \"{stream}\" WHERE device_type IN ('Mobile', 'Tablet') AND action_category IN ('performanceMetric', 'navigation') GROUP BY action_category UNION ALL SELECT 'desktop' AS device_class, action_category, COUNT(*) AS cnt FROM \"{stream}\" WHERE device_type = 'Computer' AND action_category IN ('performanceMetric', 'navigation') GROUP BY action_category",
"category": "union",
"time_offset": {
"start_offset": 23039000000,
"end_offset": 23113000000
},
"expected": {
"columns": [
"device_class",
"action_category",
"cnt"
],
"results": [
[
"mobile",
"performanceMetric",
"2"
],
[
"desktop",
"performanceMetric",
"1"
],
[
"desktop",
"navigation",
"1"
]
],
"results_mode": "rowsort"
}
},
{
"id": "Q386",
"sql": "SELECT 'errors' AS event_type, error_code AS detail, COUNT(*) AS cnt FROM \"{stream}\" WHERE action_category = 'performanceMetric' AND error_code IS NOT NULL AND exception_message LIKE '%Exception%' GROUP BY error_code UNION ALL SELECT 'upstream_errors' AS event_type, upstream_error_code AS detail, COUNT(*) AS cnt FROM \"{stream}\" WHERE action_category = 'performanceMetric' AND upstream_error_code IS NOT NULL AND upstream_error_code LIKE '%UP-E%' GROUP BY upstream_error_code",
"category": "union",
"time_offset": {
"start_offset": 23099000000,
"end_offset": 23173000000
},
"expected": {
"columns": [
"event_type",
"detail",
"cnt"
],
"results": [
[
"errors",
"E009",
"1"
],
[
"errors",
"E003",
"1"
],
[
"errors",
"E001",
"1"
],
[
"upstream_errors",
"UP-E007",
"1"
]
],
"results_mode": "rowsort"
}
},
{
"id": "Q387",
"sql": "SELECT (CASE WHEN os_platform LIKE '%Android%' THEN 'Android' ELSE 'non-Android' END) AS platform, COUNT(CASE WHEN action_category = 'navigation' THEN 1 END) AS nav_cnt, COUNT(CASE WHEN action_category = 'performanceMetric' THEN 1 END) AS metric_cnt FROM \"{stream}\" GROUP BY platform UNION ALL SELECT 'TOTAL' AS platform, COUNT(CASE WHEN action_category = 'navigation' THEN 1 END) AS nav_cnt, COUNT(CASE WHEN action_category = 'performanceMetric' THEN 1 END) AS metric_cnt FROM \"{stream}\" ",
"category": "union",
"time_offset": {
"start_offset": 23159000000,
"end_offset": 23233000000
},
"expected": {
"columns": [
"platform",
"nav_cnt",
"metric_cnt"
],
"results": [
[
"Android",
"1",
"2"
],
[
"non-Android",
"0",
"4"
],
[
"TOTAL",
"1",
"6"
]
],
"results_mode": "rowsort"
}
},
{
"id": "Q388",
"sql": "SELECT * FROM (SELECT _timestamp, 'error' AS record_type, exception_message AS detail, action_category FROM \"{stream}\" WHERE action_category = 'performanceMetric' AND exception_message LIKE '%Exception%' LIMIT 10) UNION ALL SELECT * FROM (SELECT _timestamp, 'timeout' AS record_type, event_detail AS detail, action_category FROM \"{stream}\" WHERE action_category = 'performanceMetric' AND event_detail LIKE '%timeout%' LIMIT 10)",
"category": "union",
"time_offset": {
"start_offset": 23219000000,
"end_offset": 23293000000
},
"expected": {
"columns": [
"record_type",
"detail",
"action_category"
],
"results": [
[
"error",
"NetworkException: connection to batch sync failed",
"performanceMetric"
],
[
"error",
"ConfigurationException: missing facility_zone ZONE-3 override",
"performanceMetric"
],
[
"error",
"NetworkException: connection to batch sync failed",
"performanceMetric"
],
[
"error",
"OverflowException: throughput_rate 999.0 exceeds max capacity",
"performanceMetric"
]
],
"results_mode": "rowsort"
}
},
{
"id": "Q389",
"sql": "SELECT 'prod' AS env, error_code, COUNT(*) AS cnt FROM \"{stream}\" WHERE tag_a = 'prod' AND action_category = 'performanceMetric' AND error_code IS NOT NULL GROUP BY error_code UNION ALL SELECT 'staging' AS env, error_code, COUNT(*) AS cnt FROM \"{stream}\" WHERE tag_a = 'staging' AND action_category = 'performanceMetric' AND error_code IS NOT NULL GROUP BY error_code UNION ALL SELECT 'dev' AS env, error_code, COUNT(*) AS cnt FROM \"{stream}\" WHERE tag_a = 'dev' AND action_category = 'performanceMetric' AND error_code IS NOT NULL GROUP BY error_code",
"category": "union",
"time_offset": {
"start_offset": 23279000000,
"end_offset": 23353000000
},
"expected": {
"columns": [
"env",
"error_code",
"cnt"
],
"results": [
[
"prod",
"E001",
"2"
],
[
"dev",
"E009",
"2"
]
],
"results_mode": "rowsort"
}
},
{
"id": "Q390",
"sql": "SELECT 'page_nav' AS metric, page_slug AS label, COUNT(*) AS cnt FROM \"{stream}\" WHERE action_category = 'navigation' GROUP BY page_slug UNION ALL SELECT 'component_err' AS metric, component_name AS label, COUNT(*) AS cnt FROM \"{stream}\" WHERE action_category = 'performanceMetric' AND error_code IS NOT NULL GROUP BY component_name",
"category": "union",
"time_offset": {
"start_offset": 23339000000,
"end_offset": 23413000000
},
"expected": {
"columns": [
"metric",
"label",
"cnt"
],
"results": [
[
"page_nav",
"itemPage",
"2"
],
[
"component_err",
"zone-controller",
"1"
],
[
"component_err",
"pallet-mapper",
"1"
],
[
"component_err",
"track-router",
"1"
],
[
"component_err",
"batch-sync",
"2"
]
],
"results_mode": "rowsort"
}
},
{
"id": "Q391",
"sql": "SELECT org_name, (CASE WHEN os_platform LIKE '%Android%' THEN 'Android' ELSE os_platform END) AS platform, COUNT(*) AS cnt FROM \"{stream}\" WHERE org_name IN ('warehouse-south') AND action_category = 'interaction' GROUP BY org_name, platform UNION ALL SELECT 'warehouse-north' AS org_name, (CASE WHEN os_platform LIKE '%Android%' THEN 'Android' ELSE os_platform END) AS platform, COUNT(*) AS cnt FROM \"{stream}\" WHERE org_name = 'warehouse-north' AND action_category = 'performanceMetric' GROUP BY platform",
"category": "union",
"time_offset": {
"start_offset": 23399000000,
"end_offset": 23473000000
},
"expected": {
"columns": [
"org_name",
"platform",
"cnt"
],
"results": [
[
"warehouse-south",
"Android",
"2"
],
[
"warehouse-north",
"Android",
"1"
]
],
"results_mode": "rowsort"
}
},
{
"id": "Q392",
"sql": "SELECT error_code, COUNT(*) AS cnt FROM \"{stream}\" WHERE action_category = 'performanceMetric' AND error_code IS NOT NULL GROUP BY error_code UNION ALL SELECT upstream_error_code, COUNT(*) AS cnt FROM \"{stream}\" WHERE action_category = 'performanceMetric' AND upstream_error_code IS NOT NULL GROUP BY upstream_error_code ORDER BY cnt DESC, error_code ASC LIMIT 10",
"category": "union",
"time_offset": {
"start_offset": 23459000000,
"end_offset": 23533000000
},
"expected": {
"columns": [
"error_code",
"cnt"
],
"results": [
[
"E001",
"1"
],
[
"E009",
"1"
],
[
"UP-E003",
"1"
]
],
"results_mode": "rowsort"
}
},
{
"id": "Q500",
"sql": "SELECT 'error_bucket' AS source, error_code AS label, COUNT(*) AS cnt FROM \"{stream}\" WHERE error_code IS NOT NULL GROUP BY error_code UNION ALL SELECT 'response_bucket' AS source, CAST(response_code AS VARCHAR) AS label, COUNT(*) AS cnt FROM \"{stream}\" WHERE action_category = 'performanceMetric' GROUP BY response_code ORDER BY source ASC, cnt DESC",
"category": "union",
"time_offset": {
"start_offset": 29939000000,
"end_offset": 30013000000
},
"expected": {
"columns": [
"source",
"label",
"cnt"
],
"results": [
[
"error_bucket",
"E004",
"2"
],
[
"error_bucket",
"E002",
"2"
],
[
"error_bucket",
"E001",
"1"
],
[
"error_bucket",
"E005",
"1"
],
[
"error_bucket",
"E003",
"1"
],
[
"response_bucket",
"503",
"2"
],
[
"response_bucket",
"400",
"1"
],
[
"response_bucket",
"401",
"1"
],
[
"response_bucket",
"500",
"1"
]
],
"results_mode": "rowsort"
}
},
{
"id": "Q501",
"sql": "SELECT page_slug, COUNT(*) AS cnt FROM \"{stream}\" WHERE action_category = 'navigation' AND page_slug IS NOT NULL GROUP BY page_slug UNION ALL SELECT page_slug, COUNT(*) AS cnt FROM \"{stream}\" WHERE action_category = 'interaction' AND page_slug IS NOT NULL GROUP BY page_slug ORDER BY cnt DESC, page_slug ASC",
"category": "union",
"time_offset": {
"start_offset": 29999000000,
"end_offset": 30073000000
},
"expected": {
"columns": [
"page_slug",
"cnt"
],
"results": [
[
"itemPage",
"2"
],
[
"homePage",
"1"
]
],
"results_mode": "rowsort"
}
},
{
"id": "Q502",
"sql": "SELECT action_category, 'min' AS stat, ROUND(MIN(CAST(latency_ms AS FLOAT)), 1) AS val FROM \"{stream}\" WHERE latency_ms > 0 GROUP BY action_category UNION ALL SELECT action_category, 'max' AS stat, ROUND(MAX(CAST(latency_ms AS FLOAT)), 1) AS val FROM \"{stream}\" WHERE latency_ms > 0 GROUP BY action_category UNION ALL SELECT action_category, 'avg' AS stat, ROUND(AVG(CAST(latency_ms AS FLOAT)), 1) AS val FROM \"{stream}\" WHERE latency_ms > 0 GROUP BY action_category ORDER BY action_category ASC, stat ASC",
"category": "union",
"time_offset": {
"start_offset": 30059000000,
"end_offset": 30133000000
},
"expected": {
"columns": [
"action_category",
"stat",
"val"
],
"results": [
[
"interaction",
"avg",
"1076.7"
],
[
"interaction",
"max",
"3200.0"
],
[
"interaction",
"min",
"15.0"
],
[
"navigation",
"avg",
"78.0"
],
[
"navigation",
"max",
"78.0"
],
[
"navigation",
"min",
"78.0"
],
[
"performanceMetric",
"avg",
"956.0"
],
[
"performanceMetric",
"max",
"1900.0"
],
[
"performanceMetric",
"min",
"12.0"
]
],
"results_mode": "rowsort"
}
},
{
"id": "Q503",
"sql": "SELECT 'high_tput' AS label, COUNT(*) AS cnt, ROUND(AVG(CAST(throughput_rate AS FLOAT)), 1) AS avg_val FROM \"{stream}\" WHERE throughput_rate > 500 UNION ALL SELECT 'low_tput' AS label, COUNT(*) AS cnt, ROUND(AVG(CAST(throughput_rate AS FLOAT)), 1) AS avg_val FROM \"{stream}\" WHERE throughput_rate <= 500 UNION ALL SELECT 'high_load' AS label, COUNT(*) AS cnt, ROUND(AVG(CAST(load_factor AS FLOAT)), 1) AS avg_val FROM \"{stream}\" WHERE load_factor > 50 ORDER BY label ASC",
"category": "union",
"time_offset": {
"start_offset": 30119000000,
"end_offset": 30193000000
},
"expected": {
"columns": [
"label",
"cnt",
"avg_val"
],
"results": [
[
"high_load",
"4",
"83.5"
],
[
"high_tput",
"3",
"648.3"
],
[
"low_tput",
"4",
"317.5"
]
],
"results_mode": "rowsort"
}
},
{
"id": "Q504",
"sql": "SELECT component_name, COUNT(*) AS cnt FROM \"{stream}\" WHERE component_name IN ('sorter-engine', 'conveyor-driver', 'zone-controller', 'scan-hub') AND action_category = 'performanceMetric' GROUP BY component_name UNION ALL SELECT component_name, COUNT(*) AS cnt FROM \"{stream}\" WHERE component_name IN ('track-router', 'batch-sync', 'pallet-mapper', 'lane-monitor') AND action_category = 'performanceMetric' GROUP BY component_name ORDER BY cnt DESC, component_name ASC",
"category": "union",
"time_offset": {
"start_offset": 30179000000,
"end_offset": 30253000000
},
"expected": {
"columns": [
"component_name",
"cnt"
],
"results": [
[
"batch-sync",
"2"
],
[
"lane-monitor",
"2"
],
[
"pallet-mapper",
"1"
],
[
"track-router",
"1"
]
],
"results_mode": "rowsort"
}
},
{
"id": "Q505",
"sql": "SELECT 'Mobile' AS platform_type, COUNT(*) AS cnt, ROUND(AVG(CAST(latency_ms AS FLOAT)), 1) AS avg_lat FROM \"{stream}\" WHERE device_type = 'Mobile' AND latency_ms > 0 UNION ALL SELECT 'Computer' AS platform_type, COUNT(*) AS cnt, ROUND(AVG(CAST(latency_ms AS FLOAT)), 1) AS avg_lat FROM \"{stream}\" WHERE device_type = 'Computer' AND latency_ms > 0 UNION ALL SELECT 'Tablet' AS platform_type, COUNT(*) AS cnt, ROUND(AVG(CAST(latency_ms AS FLOAT)), 1) AS avg_lat FROM \"{stream}\" WHERE device_type = 'Tablet' AND latency_ms > 0 ORDER BY platform_type ASC",
"category": "union",
"time_offset": {
"start_offset": 30239000000,
"end_offset": 30313000000
},
"expected": {
"columns": [
"platform_type",
"cnt",
"avg_lat"
],
"results": [
[
"Computer",
"3",
"220.0"
],
[
"Mobile",
"4",
"2550.0"
],
[
"Tablet",
"0",
"None"
]
],
"results_mode": "rowsort"
}
},
{
"id": "Q556",
"sql": "SELECT component_name AS source, latency_ms AS metric, 'latency' AS metric_type FROM \"{stream}\" WHERE latency_ms > 500 UNION ALL SELECT component_name AS source, lcp_micros AS metric, 'lcp' AS metric_type FROM \"{stream}\" WHERE lcp_micros > 1000000 ORDER BY metric_type, metric DESC LIMIT 15",
"category": "union",
"time_offset": {
"start_offset": 33299000000,
"end_offset": 33373000000
},
"expected": {
"columns": [
"source",
"metric",
"metric_type"
],
"results": [
[
"sorter-engine",
"1900",
"latency"
],
[
"track-router",
"3200000",
"lcp"
],
[
"zone-controller",
"2500000",
"lcp"
],
[
"scan-hub",
"1800000",
"lcp"
],
[
"scan-hub",
"1800000",
"lcp"
],
[
"conveyor-driver",
"1200000",
"lcp"
],
[
"conveyor-driver",
"1200000",
"lcp"
],
[
"sorter-engine",
"1100000",
"lcp"
]
],
"results_mode": "rowsort"
}
},
{
"id": "Q822",
"sql": "SELECT facility_zone AS zone, throughput_rate AS metric, 'rate' AS metric_type FROM \"{stream}\" WHERE throughput_rate > 300 UNION ALL SELECT facility_zone AS zone, CAST(load_factor AS BIGINT) AS metric, 'load' AS metric_type FROM \"{stream}\" WHERE load_factor > 50 ORDER BY metric_type, metric DESC LIMIT 15",
"category": "union",
"time_offset": {
"start_offset": 49259000000,
"end_offset": 49333000000
},
"expected": {
"columns": [
"zone",
"metric",
"metric_type"
],
"results": [
[
"ZONE-3",
"95.0",
"load"
],
[
"ZONE-2",
"88.0",
"load"
],
[
"ZONE-4",
"88.0",
"load"
],
[
"ZONE-1",
"73.0",
"load"
],
[
"ZONE-1",
"68.0",
"load"
],
[
"ZONE-3",
"900.0",
"rate"
],
[
"ZONE-1",
"555.0",
"rate"
],
[
"ZONE-1",
"320.0",
"rate"
]
],
"results_mode": "rowsort"
}
},
{
"id": "Q823",
"sql": "SELECT pallet_id FROM \"{stream}\" WHERE throughput_rate > 400 INTERSECT SELECT pallet_id FROM \"{stream2}\" WHERE load_factor > 30 ORDER BY pallet_id LIMIT 10",
"category": "union",
"time_offset": {
"start_offset": 49319000000,
"end_offset": 49393000000
},
"expected": {
"columns": [
"pallet_id"
],
"results": [
[
"PL-001"
],
[
"PL-007"
]
],
"results_mode": "rowsort"
}
},
{
"id": "Q824",
"sql": "SELECT facility_zone FROM \"{stream}\" WHERE throughput_rate > 500 EXCEPT SELECT facility_zone FROM \"{stream2}\" WHERE load_factor < 40 ORDER BY facility_zone",
"category": "union",
"time_offset": {
"start_offset": 49379000000,
"end_offset": 49453000000
},
"expected": {
"columns": [
"facility_zone"
],
"results": [
[
"ZONE-4"
]
],
"results_mode": "rowsort"
}
},
{
"id": "Q825",
"sql": "SELECT facility_zone AS zone, sorter_model AS model, 'stream1' AS origin FROM \"{stream}\" WHERE throughput_rate > 300 UNION ALL SELECT facility_zone AS zone, sorter_model AS model, 'stream2' AS origin FROM \"{stream2}\" WHERE load_factor > 40 ORDER BY zone, origin LIMIT 15",
"category": "union",
"time_offset": {
"start_offset": 49439000000,
"end_offset": 49513000000
},
"expected": {
"columns": [
"zone",
"model",
"origin"
],
"results": [
[
"ZONE-1",
"SORT-M3",
"stream1"
],
[
"ZONE-1",
"SORT-M3",
"stream1"
],
[
"ZONE-1",
"SORT-M3",
"stream2"
],
[
"ZONE-2",
"SORT-Q5",
"stream2"
],
[
"ZONE-2",
"SORT-Z9",
"stream2"
],
[
"ZONE-3",
"SORT-X1",
"stream1"
],
[
"ZONE-3",
"SORT-X1",
"stream1"
],
[
"ZONE-3",
"SORT-X1",
"stream2"
],
[
"ZONE-3",
"SORT-X1",
"stream2"
],
[
"ZONE-4",
"SORT-A7",
"stream2"
],
[
"ZONE-4",
"SORT-A7",
"stream2"
]
],
"results_mode": "rowsort"
}
},
{
"id": "Q826",
"sql": "SELECT component_name AS comp, AVG(CAST(latency_ms AS FLOAT)) AS avg_lat, 'stream1' AS src FROM \"{stream}\" WHERE latency_ms IS NOT NULL GROUP BY component_name UNION ALL SELECT component_name AS comp, AVG(CAST(latency_ms AS FLOAT)) AS avg_lat, 'stream2' AS src FROM \"{stream2}\" WHERE latency_ms IS NOT NULL GROUP BY component_name ORDER BY avg_lat DESC LIMIT 15",
"category": "union",
"time_offset": {
"start_offset": 49499000000,
"end_offset": 49573000000
},
"expected": {
"columns": [
"comp",
"avg_lat",
"src"
],
"results": [
[
"sorter-engine",
"1900.0",
"stream1"
],
[
"batch-sync",
"1450.0",
"stream2"
],
[
"track-router",
"230.0",
"stream1"
],
[
"track-router",
"230.0",
"stream2"
],
[
"scan-hub",
"45.0",
"stream2"
],
[
"scan-hub",
"45.0",
"stream1"
],
[
"conveyor-driver",
"15.0",
"stream1"
],
[
"conveyor-driver",
"15.0",
"stream2"
],
[
"zone-controller",
"12.0",
"stream1"
],
[
"zone-controller",
"12.0",
"stream2"
]
],
"results_mode": "rowsort"
}
},
{
"id": "Q827",
"sql": "SELECT control_center AS cc FROM \"{stream}\" WHERE operation_mode = 'auto' INTERSECT SELECT control_center AS cc FROM \"{stream2}\" WHERE operation_mode = 'auto' ORDER BY cc",
"category": "union",
"time_offset": {
"start_offset": 49559000000,
"end_offset": 49633000000
},
"expected": {
"columns": [
"cc"
],
"results": [
[
"CC-ALPHA"
],
[
"CC-DELTA"
],
[
"CC-GAMMA"
]
],
"results_mode": "rowsort"
}
},
{
"id": "Q828",
"sql": "SELECT sorter_model FROM \"{stream}\" WHERE facility_zone IN ('ZONE-1', 'ZONE-2') EXCEPT SELECT sorter_model FROM \"{stream2}\" WHERE facility_zone IN ('ZONE-3', 'ZONE-4') ORDER BY sorter_model LIMIT 10",
"category": "union",
"time_offset": {
"start_offset": 49619000000,
"end_offset": 49693000000
},
"expected": {
"columns": [
"sorter_model"
],
"results": [
[
"SORT-M3"
],
[
"SORT-Q5"
],
[
"SORT-Z9"
]
],
"results_mode": "rowsort"
}
},
{
"id": "Q829",
"sql": "SELECT facility_zone FROM (SELECT facility_zone FROM \"{stream}\" WHERE throughput_rate > 400 UNION ALL SELECT facility_zone FROM \"{stream2}\" WHERE load_factor > 40) combined GROUP BY facility_zone HAVING COUNT(*) > 1 ORDER BY facility_zone",
"category": "union",
"time_offset": {
"start_offset": 49679000000,
"end_offset": 49753000000
},
"expected": {
"columns": [
"facility_zone"
],
"results": [
[
"ZONE-1"
],
[
"ZONE-3"
],
[
"ZONE-4"
]
],
"results_mode": "rowsort"
}
},
{
"id": "Q830",
"sql": "WITH set_a AS (SELECT org_name FROM \"{stream}\" WHERE throughput_rate > 200), set_b AS (SELECT org_name FROM \"{stream2}\" WHERE load_factor > 30) SELECT org_name FROM set_a INTERSECT SELECT org_name FROM set_b ORDER BY org_name LIMIT 10",
"category": "union",
"time_offset": {
"start_offset": 49739000000,
"end_offset": 49813000000
},
"expected": {
"columns": [
"org_name"
],
"results": [
[
"warehouse-central"
],
[
"warehouse-north"
],
[
"warehouse-west"
]
],
"results_mode": "rowsort"
}
},
{
"id": "Q831",
"sql": "SELECT facility_zone, SUM(cnt) AS total FROM (SELECT facility_zone, COUNT(*) AS cnt FROM \"{stream}\" WHERE throughput_rate > 200 GROUP BY facility_zone UNION ALL SELECT facility_zone, COUNT(*) AS cnt FROM \"{stream2}\" WHERE load_factor > 30 GROUP BY facility_zone) combined GROUP BY facility_zone ORDER BY total DESC",
"category": "union",
"time_offset": {
"start_offset": 49799000000,
"end_offset": 49873000000
},
"expected": {
"columns": [
"facility_zone",
"total"
],
"results": [
[
"ZONE-1",
"4"
],
[
"ZONE-3",
"3"
],
[
"ZONE-2",
"3"
],
[
"ZONE-4",
"3"
]
],
"results_mode": "rowsort"
}
},
{
"id": "Q832",
"sql": "SELECT pallet_id, SUM(throughput_rate) AS total_rate FROM (SELECT pallet_id, throughput_rate FROM \"{stream}\" UNION ALL SELECT pallet_id, throughput_rate FROM \"{stream2}\") combined GROUP BY pallet_id ORDER BY total_rate DESC LIMIT 12",
"category": "union",
"time_offset": {
"start_offset": 49859000000,
"end_offset": 49933000000
},
"expected": {
"columns": [
"pallet_id",
"total_rate"
],
"results": [
[
"PL-003",
"1800.0"
],
[
"PL-005",
"1220.0"
],
[
"PL-001",
"875.0"
],
[
"PL-008",
"670.0"
],
[
"PL-004",
"340.0"
],
[
"PL-007",
"320.0"
],
[
"PL-006",
"300.0"
],
[
"PL-002",
"190.0"
]
],
"results_mode": "rowsort"
}
},
{
"id": "Q833",
"sql": "WITH top_stream1 AS (SELECT facility_zone, throughput_rate FROM \"{stream}\" WHERE throughput_rate > 400), top_stream2 AS (SELECT facility_zone, load_factor AS metric FROM \"{stream2}\" WHERE load_factor > 50) SELECT facility_zone, AVG(CAST(throughput_rate AS FLOAT)) AS avg_rate, COUNT(*) AS top_count FROM (SELECT facility_zone, throughput_rate FROM top_stream1 UNION ALL SELECT facility_zone, 0 AS throughput_rate FROM top_stream2) u GROUP BY facility_zone ORDER BY avg_rate DESC",
"category": "union",
"time_offset": {
"start_offset": 49919000000,
"end_offset": 49993000000
},
"expected": {
"columns": [
"facility_zone",
"avg_rate",
"top_count"
],
"results": [
[
"ZONE-4",
"725.0",
"1"
],
[
"ZONE-2",
"480.0",
"1"
],
[
"ZONE-1",
"305.0",
"2"
],
[
"ZONE-3",
"305.0",
"2"
]
],
"results_mode": "rowsort"
}
},
{
"id": "Q834",
"sql": "SELECT component_name FROM \"{stream}\" WHERE latency_ms > 500 INTERSECT SELECT component_name FROM \"{stream}\" WHERE response_code >= 400 ORDER BY component_name LIMIT 10",
"category": "union",
"time_offset": {
"start_offset": 49979000000,
"end_offset": 50053000000
},
"expected": {
"columns": [
"component_name"
],
"results": [
[
"batch-sync"
],
[
"lane-monitor"
]
],
"results_mode": "rowsort"
}
},
{
"id": "Q835",
"sql": "SELECT component_name FROM \"{stream}\" WHERE latency_ms > 500 EXCEPT SELECT component_name FROM \"{stream}\" WHERE response_code >= 400 ORDER BY component_name LIMIT 10",
"category": "union",
"time_offset": {
"start_offset": 50039000000,
"end_offset": 50113000000
},
"expected": {
"columns": [
"component_name"
],
"results": [
[
"sorter-engine"
],
[
"temp-regulator"
]
],
"results_mode": "rowsort"
}
},
{
"id": "Q836",
"sql": "SELECT conveyor_lane, sorter_model FROM \"{stream}\" WHERE facility_zone = 'ZONE-1' UNION ALL SELECT conveyor_lane, sorter_model FROM \"{stream}\" WHERE facility_zone = 'ZONE-3' UNION ALL SELECT conveyor_lane, sorter_model FROM \"{stream2}\" WHERE facility_zone = 'ZONE-2' ORDER BY conveyor_lane, sorter_model LIMIT 12",
"category": "union",
"time_offset": {
"start_offset": 50099000000,
"end_offset": 50173000000
},
"expected": {
"columns": [
"conveyor_lane",
"sorter_model"
],
"results": [
[
"LANE-B",
"SORT-M3"
],
[
"LANE-C",
"SORT-Q5"
],
[
"LANE-C",
"SORT-Z9"
],
[
"LANE-D",
"SORT-X1"
],
[
"LANE-D",
"SORT-X1"
]
],
"results_mode": "rowsort"
}
},
{
"id": "Q837",
"sql": "SELECT operation_mode, SUM(cnt) AS total_ops FROM (SELECT operation_mode, COUNT(*) AS cnt FROM \"{stream}\" GROUP BY operation_mode UNION ALL SELECT operation_mode, COUNT(*) AS cnt FROM \"{stream2}\" GROUP BY operation_mode) merged GROUP BY operation_mode ORDER BY total_ops DESC",
"category": "union",
"time_offset": {
"start_offset": 50159000000,
"end_offset": 50233000000
},
"expected": {
"columns": [
"operation_mode",
"total_ops"
],
"results": [
[
"auto",
"6"
],
[
"hybrid",
"4"
],
[
"manual",
"4"
]
],
"results_mode": "rowsort"
}
},
{
"id": "Q838",
"sql": "WITH high AS (SELECT pallet_id, throughput_rate FROM \"{stream}\" WHERE throughput_rate >= 500), medium AS (SELECT pallet_id, throughput_rate FROM \"{stream}\" WHERE throughput_rate BETWEEN 300 AND 499), low AS (SELECT pallet_id, throughput_rate FROM \"{stream}\" WHERE throughput_rate < 300) SELECT 'high' AS tier, COUNT(*) AS cnt FROM high UNION ALL SELECT 'medium' AS tier, COUNT(*) AS cnt FROM medium UNION ALL SELECT 'low' AS tier, COUNT(*) AS cnt FROM low ORDER BY tier",
"category": "union",
"time_offset": {
"start_offset": 50219000000,
"end_offset": 50293000000
},
"expected": {
"columns": [
"tier",
"cnt"
],
"results": [
[
"high",
"3"
],
[
"low",
"4"
],
[
"medium",
"0"
]
],
"results_mode": "rowsort"
}
},
{
"id": "Q839",
"sql": "SELECT facility_zone, COUNT(*) AS cnt FROM (SELECT facility_zone FROM \"{stream}\" WHERE match_all('warehouse') UNION ALL SELECT facility_zone FROM \"{stream}\" WHERE match_all('error')) fts_hits GROUP BY facility_zone ORDER BY cnt DESC",
"category": "union",
"time_offset": {
"start_offset": 50279000000,
"end_offset": 50353000000
},
"expected": {
"columns": [
"facility_zone",
"cnt"
],
"results": [
[
"ZONE-3",
"2"
],
[
"ZONE-1",
"2"
],
[
"ZONE-2",
"2"
],
[
"ZONE-4",
"1"
]
],
"results_mode": "rowsort"
}
},
{
"id": "Q840",
"sql": "WITH a AS (SELECT region_code, component_name FROM \"{stream}\" WHERE latency_ms > 500), b AS (SELECT region_code, component_name FROM \"{stream2}\" WHERE latency_ms > 300) SELECT region_code, component_name FROM a INTERSECT SELECT region_code, component_name FROM b ORDER BY region_code LIMIT 10",
"category": "union",
"time_offset": {
"start_offset": 50339000000,
"end_offset": 50413000000
},
"expected": {
"columns": [
"region_code",
"component_name"
],
"results": [
[
"AP-SOUTH",
"batch-sync"
]
],
"results_mode": "rowsort"
}
},
{
"id": "Q841",
"sql": "SELECT org_name, COUNT(*) AS cnt FROM (SELECT org_name FROM \"{stream}\" WHERE throughput_rate > 200 UNION ALL SELECT org_name FROM \"{stream2}\" WHERE load_factor > 30) merged WHERE org_name IS NOT NULL GROUP BY org_name HAVING COUNT(*) > 1 ORDER BY cnt DESC LIMIT 10",
"category": "union",
"time_offset": {
"start_offset": 50399000000,
"end_offset": 50473000000
},
"expected": {
"columns": [
"org_name",
"cnt"
],
"results": [
[
"warehouse-south",
"3"
],
[
"warehouse-west",
"3"
],
[
"warehouse-north",
"3"
],
[
"warehouse-east",
"2"
],
[
"warehouse-central",
"2"
]
],
"results_mode": "rowsort"
}
},
{
"id": "Q842",
"sql": "SELECT a.pallet_id FROM \"{stream}\" a WHERE a.throughput_rate > 300 INTERSECT SELECT b.pallet_id FROM \"{stream2}\" b WHERE b.load_factor > 40 ORDER BY pallet_id LIMIT 10",
"category": "union",
"time_offset": {
"start_offset": 50459000000,
"end_offset": 50533000000
},
"expected": {
"columns": [
"pallet_id"
],
"results": [
[
"PL-003"
],
[
"PL-005"
],
[
"PL-007"
]
],
"results_mode": "rowsort"
}
},
{
"id": "Q843",
"sql": "SELECT pallet_id, MAX(metric) AS peak FROM (SELECT pallet_id, throughput_rate AS metric FROM \"{stream}\" UNION ALL SELECT pallet_id, load_factor AS metric FROM \"{stream2}\") u GROUP BY pallet_id ORDER BY peak DESC LIMIT 12",
"category": "union",
"time_offset": {
"start_offset": 50519000000,
"end_offset": 50593000000
},
"expected": {
"columns": [
"pallet_id",
"peak"
],
"results": [
[
"PL-004",
"725.0"
],
[
"PL-003",
"610.0"
],
[
"PL-005",
"610.0"
],
[
"PL-002",
"480.0"
],
[
"PL-001",
"320.0"
],
[
"PL-007",
"320.0"
],
[
"PL-008",
"150.0"
],
[
"PL-006",
"12.5"
]
],
"results_mode": "rowsort"
}
},
{
"id": "Q844",
"sql": "WITH all_records AS (SELECT _timestamp, facility_zone, throughput_rate FROM \"{stream}\" UNION ALL SELECT _timestamp, facility_zone, throughput_rate FROM \"{stream2}\") SELECT facility_zone, COUNT(*) AS total_cnt, AVG(throughput_rate) AS avg_rate, MAX(throughput_rate) AS peak_rate FROM all_records GROUP BY facility_zone ORDER BY peak_rate DESC",
"category": "union",
"time_offset": {
"start_offset": 50579000000,
"end_offset": 50653000000
},
"expected": {
"columns": [
"facility_zone",
"total_cnt",
"avg_rate",
"peak_rate"
],
"results": [
[
"ZONE-1",
"3",
"745.0",
"840.0"
],
[
"ZONE-3",
"4",
"640.0",
"840.0"
],
[
"ZONE-2",
"4",
"482.5",
"725.0"
],
[
"ZONE-4",
"3",
"435.0",
"725.0"
]
],
"results_mode": "rowsort"
}
},
{
"id": "Q845",
"sql": "SELECT component_name, SUM(cnt) AS total FROM (SELECT component_name, COUNT(*) AS cnt FROM \"{stream}\" GROUP BY component_name UNION ALL SELECT component_name, COUNT(*) AS cnt FROM \"{stream2}\" GROUP BY component_name) merged GROUP BY component_name ORDER BY total DESC LIMIT 12",
"category": "union",
"time_offset": {
"start_offset": 50639000000,
"end_offset": 50713000000
},
"expected": {
"columns": [
"component_name",
"total"
],
"results": [
[
"temp-regulator",
"3"
],
[
"conveyor-driver",
"3"
],
[
"charge-checker",
"3"
],
[
"sorter-engine",
"3"
],
[
"zone-controller",
"1"
],
[
"lane-monitor",
"1"
]
],
"results_mode": "rowsort"
}
},
{
"id": "Q846",
"sql": "WITH s1 AS (SELECT facility_zone, operation_mode FROM \"{stream}\" WHERE throughput_rate > 300), s2 AS (SELECT facility_zone, operation_mode FROM \"{stream2}\" WHERE load_factor > 40) SELECT facility_zone, operation_mode FROM s1 UNION SELECT facility_zone, operation_mode FROM s2 ORDER BY facility_zone, operation_mode LIMIT 12",
"category": "union",
"time_offset": {
"start_offset": 50699000000,
"end_offset": 50773000000
},
"expected": {
"columns": [
"facility_zone",
"operation_mode"
],
"results": [
[
"ZONE-1",
"auto"
],
[
"ZONE-1",
"manual"
],
[
"ZONE-2",
"auto"
],
[
"ZONE-3",
"hybrid"
],
[
"ZONE-3",
"manual"
],
[
"ZONE-4",
"auto"
]
],
"results_mode": "rowsort"
}
},
{
"id": "Q847",
"sql": "SELECT conveyor_lane FROM \"{stream}\" WHERE facility_zone = 'ZONE-1' INTERSECT SELECT conveyor_lane FROM \"{stream2}\" WHERE facility_zone = 'ZONE-2' ORDER BY conveyor_lane",
"category": "union",
"time_offset": {
"start_offset": 50759000000,
"end_offset": 50833000000
},
"expected": {
"columns": [
"conveyor_lane"
],
"results": [],
"results_mode": "rowsort"
}
},
{
"id": "Q848",
"sql": "SELECT tag_a AS tag FROM \"{stream}\" WHERE throughput_rate > 300 UNION SELECT tag_b AS tag FROM \"{stream2}\" WHERE load_factor > 40 ORDER BY tag LIMIT 10",
"category": "union",
"time_offset": {
"start_offset": 50819000000,
"end_offset": 50893000000
},
"expected": {
"columns": [
"tag"
],
"results": [
[
"critical"
],
[
"dev"
],
[
"high"
],
[
"low"
],
[
"medium"
],
[
"prod"
],
[
"staging"
]
],
"results_mode": "rowsort"
}
},
{
"id": "Q849",
"sql": "WITH agg AS (SELECT facility_zone, AVG(throughput_rate) AS avg_val, 'rate' AS val_type FROM \"{stream}\" GROUP BY facility_zone UNION ALL SELECT facility_zone, AVG(CAST(load_factor AS FLOAT)) AS avg_val, 'load' AS val_type FROM \"{stream2}\" GROUP BY facility_zone) SELECT facility_zone, val_type, avg_val, RANK() OVER (PARTITION BY val_type ORDER BY avg_val DESC) AS rk FROM agg ORDER BY val_type, rk LIMIT 12",
"category": "union",
"time_offset": {
"start_offset": 50879000000,
"end_offset": 50953000000
},
"expected": {
"columns": [
"facility_zone",
"val_type",
"avg_val",
"rk"
],
"results": [
[
"ZONE-3",
"load",
"96.79999923706055",
"1"
],
[
"ZONE-1",
"load",
"67.9000015258789",
"2"
],
[
"ZONE-2",
"load",
"33.34999942779541",
"3"
],
[
"ZONE-4",
"load",
"33.34999942779541",
"3"
],
[
"ZONE-1",
"rate",
"610.0",
"1"
],
[
"ZONE-3",
"rate",
"610.0",
"1"
],
[
"ZONE-4",
"rate",
"335.0",
"3"
],
[
"ZONE-2",
"rate",
"150.0",
"4"
]
],
"results_mode": "rowsort"
}
}
],
"last_query_id": 158
}