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

2547 lines
64 KiB
JSON

{
"queries": [
{
"id": "Q063",
"sql": "SELECT histogram(_timestamp, '2 minutes') AS _time, COUNT(*) AS cnt FROM \"{stream}\" GROUP BY _time ORDER BY _time ASC",
"category": "date_time",
"expected": {
"columns": [
"_time",
"cnt"
],
"results": [
[
"2026-08-14T06:06:00",
"5"
],
[
"2026-08-14T06:08:00",
"9"
]
],
"results_mode": "rowsort"
},
"time_offset": {
"start_offset": 3719000000,
"end_offset": 3883000000
}
},
{
"id": "Q064",
"sql": "SELECT histogram(_timestamp, '1 minute') AS ts_minute, operation_mode, COUNT(*) AS cnt FROM \"{stream}\" GROUP BY ts_minute, operation_mode ORDER BY ts_minute ASC, operation_mode ASC",
"category": "date_time",
"expected": {
"columns": [
"ts_minute",
"operation_mode",
"cnt"
],
"results": [
[
"2026-08-14T06:08:00",
"auto",
"2"
],
[
"2026-08-14T06:08:00",
"hybrid",
"1"
],
[
"2026-08-14T06:08:00",
"manual",
"2"
],
[
"2026-08-14T06:09:00",
"auto",
"1"
],
[
"2026-08-14T06:09:00",
"hybrid",
"2"
],
[
"2026-08-14T06:09:00",
"manual",
"2"
],
[
"2026-08-14T06:10:00",
"auto",
"2"
],
[
"2026-08-14T06:10:00",
"manual",
"2"
]
],
"results_mode": "rowsort"
},
"time_offset": {
"start_offset": 3779000000,
"end_offset": 3943000000
}
},
{
"id": "Q065",
"sql": "SELECT _timestamp, pallet_id, facility_zone, log FROM \"{stream}\" ORDER BY _timestamp DESC LIMIT 5",
"category": "date_time",
"expected": {
"columns": [
"pallet_id",
"facility_zone",
"log"
],
"results": [
[
"PL-002",
"ZONE-4",
"Q067 warehouse event record 2"
],
[
"PL-001",
"ZONE-3",
"Q067 warehouse event record 1"
],
[
"PL-007",
"ZONE-1",
"Q066 warehouse event record 4"
],
[
"PL-008",
"ZONE-2",
"Q067 warehouse event record 0 ACK batch batchIdList:Q067-0"
],
[
"PL-006",
"ZONE-4",
"Q066 warehouse event record 3 ACK batch batchIdList:Q066-3"
]
],
"results_mode": "rowsort"
},
"time_offset": {
"start_offset": 3839000000,
"end_offset": 4003000000
}
},
{
"id": "Q066",
"sql": "SELECT histogram(_timestamp, '5 minutes') AS _time, SUM(throughput_rate) AS total_tput, MIN(throughput_rate) AS min_tput, MAX(throughput_rate) AS max_tput FROM \"{stream}\" WHERE throughput_rate IS NOT NULL GROUP BY _time ORDER BY _time ASC",
"category": "date_time",
"expected": {
"columns": [
"_time",
"total_tput",
"min_tput",
"max_tput"
],
"results": [
[
"2026-08-14T06:10:00",
"7240.0",
"150.0",
"900.0"
]
],
"results_mode": "rowsort"
},
"time_offset": {
"start_offset": 3899000000,
"end_offset": 4063000000
}
},
{
"id": "Q067",
"sql": "SELECT histogram(_timestamp, '1 minute') AS minute_bucket, COUNT(*) FILTER (WHERE operation_mode='auto') AS auto_cnt, COUNT(*) FILTER (WHERE operation_mode='manual') AS manual_cnt, COUNT(*) FILTER (WHERE operation_mode='hybrid') AS hybrid_cnt FROM \"{stream}\" GROUP BY minute_bucket ORDER BY minute_bucket ASC",
"category": "date_time",
"expected": {
"columns": [
"minute_bucket",
"auto_cnt",
"manual_cnt",
"hybrid_cnt"
],
"results": [
[
"2026-08-14T06:11:00",
"2",
"2",
"1"
],
[
"2026-08-14T06:12:00",
"2",
"2",
"1"
],
[
"2026-08-14T06:13:00",
"2",
"1",
"1"
]
],
"results_mode": "rowsort"
},
"time_offset": {
"start_offset": 3959000000,
"end_offset": 4123000000
}
},
{
"id": "Q068",
"sql": "SELECT histogram(_timestamp, '30 seconds') AS half_min, facility_zone, COUNT(*) AS cnt, ROUND(AVG(load_factor), 2) AS avg_load, ROUND(MIN(charge_remaining), 2) AS min_charge FROM \"{stream}\" WHERE cell_temp >= 22.0 GROUP BY half_min, facility_zone HAVING ROUND(AVG(load_factor), 2) > 30.0 ORDER BY half_min ASC, facility_zone ASC",
"category": "date_time",
"expected": {
"columns": [
"half_min",
"facility_zone",
"cnt",
"avg_load",
"min_charge"
],
"results": [
[
"2026-08-14T06:12:00",
"ZONE-3",
"1",
"33.0",
"33.3"
],
[
"2026-08-14T06:12:30",
"ZONE-1",
"1",
"72.8",
"10.0"
],
[
"2026-08-14T06:12:30",
"ZONE-2",
"1",
"88.1",
"25.0"
],
[
"2026-08-14T06:13:00",
"ZONE-1",
"1",
"94.6",
"42.5"
],
[
"2026-08-14T06:13:00",
"ZONE-3",
"1",
"94.6",
"42.5"
],
[
"2026-08-14T06:13:00",
"ZONE-4",
"1",
"88.1",
"25.0"
],
[
"2026-08-14T06:13:30",
"ZONE-2",
"1",
"45.3",
"58.0"
],
[
"2026-08-14T06:14:30",
"ZONE-3",
"1",
"99.0",
"95.0"
]
],
"results_mode": "rowsort"
},
"time_offset": {
"start_offset": 4019000000,
"end_offset": 4183000000
}
},
{
"id": "Q069",
"sql": "WITH bucketed AS (SELECT histogram(_timestamp, '2 minutes') AS block, COUNT(*) AS cnt, ROUND(AVG(throughput_rate), 2) AS avg_tput FROM \"{stream}\" GROUP BY block) SELECT *, ROUND(AVG(avg_tput) OVER (ORDER BY block ROWS BETWEEN 2 PRECEDING AND CURRENT ROW), 2) AS smoothed_avg, ROW_NUMBER() OVER (ORDER BY cnt DESC) AS peak_rank FROM bucketed ORDER BY block ASC",
"category": "date_time",
"expected": {
"columns": [
"block",
"cnt",
"avg_tput",
"smoothed_avg",
"peak_rank"
],
"results": [
[
"2026-08-14T06:12:00",
"5",
"492.0",
"492.0",
"2"
],
[
"2026-08-14T06:14:00",
"9",
"590.0",
"541.0",
"1"
]
],
"results_mode": "rowsort"
},
"time_offset": {
"start_offset": 4079000000,
"end_offset": 4243000000
}
},
{
"id": "Q070",
"sql": "SELECT histogram(_timestamp, '5 minutes') AS window_5m, sorter_model, COUNT(*) AS samples, ROUND(AVG(throughput_rate), 2) AS avg_tput, ROUND(AVG(cell_temp), 2) AS avg_temp, ROUND(CAST(SUM(CASE WHEN scan_attempts >= 3 THEN 1 ELSE 0 END) AS FLOAT) / NULLIF(COUNT(*), 0) * 100.0, 2) AS high_scan_pct FROM \"{stream}\" WHERE throughput_rate IS NOT NULL GROUP BY window_5m, sorter_model HAVING COUNT(*) >= 2 ORDER BY window_5m ASC, avg_tput DESC",
"category": "date_time",
"expected": {
"columns": [
"window_5m",
"sorter_model",
"samples",
"avg_tput",
"avg_temp",
"high_scan_pct"
],
"results": [
[
"2026-08-14T06:10:00",
"SORT-A7",
"2",
"602.5",
"28.65",
"50.0"
],
[
"2026-08-14T06:15:00",
"SORT-M3",
"3",
"765.0",
"30.7",
"100.0"
],
[
"2026-08-14T06:15:00",
"SORT-X1",
"2",
"697.5",
"31.0",
"100.0"
],
[
"2026-08-14T06:15:00",
"SORT-A7",
"2",
"240.0",
"22.4",
"0.0"
]
],
"results_mode": "rowsort"
},
"time_offset": {
"start_offset": 4139000000,
"end_offset": 4303000000
}
},
{
"id": "Q071",
"sql": "SELECT histogram(_timestamp) AS default_bucket, control_center, operation_mode, COUNT(*) AS event_count, ROUND(SUM(item_count), 0) AS total_items, ROUND(AVG(charge_remaining), 2) AS avg_charge FROM \"{stream}\" WHERE item_count >= 100 GROUP BY default_bucket, control_center, operation_mode ORDER BY default_bucket ASC, event_count DESC",
"category": "date_time",
"expected": {
"row_count": 19,
"columns": [
"default_bucket",
"control_center",
"operation_mode",
"event_count",
"total_items",
"avg_charge"
],
"note": "Default histogram + 3-field GROUP BY with item filter",
"skip_row_count": true,
"assertions": [
{
"type": "value_range",
"column": "event_count",
"min": 0
},
{
"type": "value_range",
"column": "total_items",
"min": 0
}
]
},
"time_offset": {
"start_offset": 4199000000,
"end_offset": 4363000000
}
},
{
"id": "Q072",
"sql": "SELECT bucket_a._time AS early_window, bucket_a.cnt AS early_cnt, bucket_a.avg_tput AS early_avg_tput, bucket_b._time AS late_window, bucket_b.cnt AS late_cnt, bucket_b.avg_tput AS late_avg_tput FROM (SELECT histogram(_timestamp, '3 minutes') AS _time, COUNT(*) AS cnt, ROUND(AVG(throughput_rate), 2) AS avg_tput FROM \"{stream}\" WHERE _timestamp < (SELECT MIN(_timestamp) + (MAX(_timestamp) - MIN(_timestamp)) / 2 FROM \"{stream}\") GROUP BY _time) bucket_a FULL OUTER JOIN (SELECT histogram(_timestamp, '3 minutes') AS _time, COUNT(*) AS cnt, ROUND(AVG(throughput_rate), 2) AS avg_tput FROM \"{stream}\" WHERE _timestamp >= (SELECT MIN(_timestamp) + (MAX(_timestamp) - MIN(_timestamp)) / 2 FROM \"{stream}\") GROUP BY _time) bucket_b ON bucket_a._time = bucket_b._time ORDER BY early_window ASC NULLS LAST",
"category": "date_time",
"expected": {
"columns": [
"early_window",
"early_cnt",
"early_avg_tput",
"late_window",
"late_cnt",
"late_avg_tput"
],
"results": [
[
"2026-08-14T06:15:00",
"7",
"350.71",
"2026-08-14T06:15:00",
"3",
"470.0"
],
[
"None",
"None",
"None",
"2026-08-14T06:18:00",
"4",
"725.0"
]
],
"results_mode": "rowsort",
"skip_sqllogictest": true,
"skip_column_check": true
},
"time_offset": {
"start_offset": 4259000000,
"end_offset": 4423000000
}
},
{
"id": "Q073",
"sql": "SELECT histogram(_timestamp, '1 minute') AS minute_slot, COUNT(*) AS total_events, ROUND(AVG(CASE WHEN cell_temp >= 28.0 THEN throughput_rate ELSE NULL END), 2) AS avg_tput_hot, ROUND(AVG(CASE WHEN cell_temp < 28.0 THEN throughput_rate ELSE NULL END), 2) AS avg_tput_cool FROM \"{stream}\" WHERE throughput_rate IS NOT NULL GROUP BY minute_slot ORDER BY minute_slot ASC",
"category": "date_time",
"expected": {
"columns": [
"minute_slot",
"total_events",
"avg_tput_hot",
"avg_tput_cool"
],
"results": [
[
"2026-08-14T06:17:00",
"5",
"380.0",
"373.33"
],
[
"2026-08-14T06:18:00",
"5",
"725.0",
"290.0"
],
[
"2026-08-14T06:19:00",
"4",
"None",
"397.5"
]
],
"results_mode": "rowsort"
},
"time_offset": {
"start_offset": 4319000000,
"end_offset": 4483000000
}
},
{
"id": "Q188",
"sql": "SELECT\n (_timestamp - (_timestamp % 60000000)) AS ts_minute,\n facility_zone,\n COUNT(*) AS cnt,\n AVG(throughput_rate) AS avg_throughput,\n MAX(cell_temp) AS max_temp,\n MIN(charge_remaining) AS min_charge,\n SUM(item_count) AS total_items\nFROM \"{stream}\"\nWHERE load_factor > 20.0\n AND throughput_rate >= 100.0\nGROUP BY (_timestamp - (_timestamp % 60000000)), facility_zone\nHAVING COUNT(*) >= 1\nORDER BY ts_minute DESC, cnt DESC\nLIMIT 20",
"category": "date_time",
"time_offset": {
"start_offset": 11219000000,
"end_offset": 11383000000
},
"expected": {
"columns": [
"ts_minute",
"facility_zone",
"cnt",
"avg_throughput",
"max_temp",
"min_charge",
"total_items"
],
"results": [
[
"1786695240000000",
"ZONE-2",
"1",
"480.0",
"24.8",
"88.7",
"275"
],
[
"1786695240000000",
"ZONE-1",
"1",
"320.0",
"19.2",
"75.3",
"410"
],
[
"1786695240000000",
"ZONE-3",
"1",
"610.0",
"28.9",
"95.0",
"60"
],
[
"1786695240000000",
"ZONE-4",
"1",
"480.0",
"24.8",
"88.7",
"275"
],
[
"1786695180000000",
"ZONE-3",
"2",
"610.0",
"30.1",
"42.5",
"498"
],
[
"1786695180000000",
"ZONE-4",
"1",
"190.0",
"26.3",
"25.0",
"340"
],
[
"1786695180000000",
"ZONE-1",
"1",
"900.0",
"30.1",
"42.5",
"88"
],
[
"1786695180000000",
"ZONE-2",
"1",
"150.0",
"35.7",
"58.0",
"155"
],
[
"1786695120000000",
"ZONE-2",
"2",
"240.0",
"26.3",
"25.0",
"460"
],
[
"1786695120000000",
"ZONE-4",
"1",
"290.0",
"18.5",
"66.6",
"120"
],
[
"1786695120000000",
"ZONE-1",
"1",
"555.0",
"22.0",
"10.0",
"200"
],
[
"1786695120000000",
"ZONE-3",
"1",
"840.0",
"40.0",
"33.3",
"50"
]
],
"results_mode": "rowsort"
}
},
{
"id": "Q189",
"sql": "SELECT time_band, facility_zone,\n COUNT(*) AS cnt,\n AVG(throughput_rate) AS avg_throughput\nFROM (\n SELECT _timestamp, facility_zone, throughput_rate, load_factor,\n CASE\n WHEN ((_timestamp - MIN(_timestamp) OVER ()) / 60000000) < 60 THEN 'first_minute'\n WHEN ((_timestamp - MIN(_timestamp) OVER ()) / 60000000) < 120 THEN 'second_minute'\n ELSE 'later'\n END AS time_band\n FROM \"{stream}\"\n WHERE load_factor > 10.0\n) sub\nGROUP BY time_band, facility_zone\nHAVING COUNT(*) >= 1\nORDER BY time_band, cnt DESC",
"category": "date_time",
"time_offset": {
"start_offset": 11279000000,
"end_offset": 11443000000
},
"expected": {
"columns": [
"time_band",
"facility_zone",
"cnt",
"avg_throughput"
],
"results": [
[
"first_minute",
"ZONE-3",
"4",
"667.5"
],
[
"first_minute",
"ZONE-4",
"4",
"421.25"
],
[
"first_minute",
"ZONE-1",
"3",
"686.6666666666666"
],
[
"first_minute",
"ZONE-2",
"3",
"451.6666666666667"
]
],
"results_mode": "rowsort"
}
},
{
"id": "Q296",
"sql": "SELECT _timestamp, _timestamp - 360000000 AS reduced_start, _timestamp + 60000000 AS reduced_end, visitor_session_id, action_category, exception_message FROM \"{stream}\" WHERE action_category = 'performanceMetric' AND exception_message LIKE '%Exception%' AND visitor_session_id IS NOT NULL",
"category": "date_time",
"time_offset": {
"start_offset": 17699000000,
"end_offset": 17773000000
},
"expected": {
"columns": [
"reduced_start",
"reduced_end",
"visitor_session_id",
"action_category",
"exception_message"
],
"results": [
[
"1786701240000000",
"1786701660000000",
"sess_001",
"performanceMetric",
"OverflowException: throughput_rate 999.0 exceeds max capacity"
],
[
"1786701276000000",
"1786701696000000",
"sess_003",
"performanceMetric",
"TimeoutException: lane LANE-A did not respond within 5000ms"
],
[
"1786701312000000",
"1786701732000000",
"sess_001",
"performanceMetric",
"ResourceExhaustedException: sorter_model SORT-M3 queue full"
]
],
"results_mode": "rowsort"
}
},
{
"id": "Q297",
"sql": "SELECT (_timestamp - (_timestamp % 60000000)) AS minute_bucket, COUNT(*) AS cnt FROM \"{stream}\" WHERE action_category = 'navigation' AND page_slug = 'itemPage' GROUP BY minute_bucket ORDER BY minute_bucket",
"category": "date_time",
"time_offset": {
"start_offset": 17759000000,
"end_offset": 17833000000
},
"expected": {
"columns": [
"minute_bucket",
"cnt"
],
"results": [
[
"1786701660000000",
"1"
]
],
"results_mode": "rowsort"
}
},
{
"id": "Q298",
"sql": "SELECT action_category, COUNT(*) AS cnt, MIN(_timestamp) AS first_event, MAX(_timestamp) AS last_event FROM \"{stream}\" WHERE action_category IN ('performanceMetric', 'navigation') GROUP BY action_category",
"category": "date_time",
"time_offset": {
"start_offset": 17819000000,
"end_offset": 17893000000
},
"expected": {
"columns": [
"action_category",
"cnt",
"first_event",
"last_event"
],
"results": [
[
"performanceMetric",
"4",
"1786701720000000",
"1786701792000000"
],
[
"navigation",
"2",
"1786701774000000",
"1786701780000000"
]
],
"results_mode": "rowsort"
}
},
{
"id": "Q299",
"sql": "SELECT _timestamp, concat(page_slug, '-', action_category) AS event_type, latency_ms, component_name FROM \"{stream}\" WHERE action_category = 'performanceMetric' AND latency_ms > 79 ORDER BY _timestamp DESC LIMIT 20",
"category": "date_time",
"time_offset": {
"start_offset": 17879000000,
"end_offset": 17953000000
},
"expected": {
"columns": [
"event_type",
"latency_ms",
"component_name"
],
"results": [
[
"itemPage-performanceMetric",
"1900",
"sorter-engine"
],
[
"itemPage-performanceMetric",
"1900",
"sorter-engine"
]
],
"results_mode": "rowsort"
}
},
{
"id": "Q300",
"sql": "SELECT (_timestamp - (_timestamp % 120000000)) AS two_min_bucket, (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 two_min_bucket, platform ORDER BY two_min_bucket",
"category": "date_time",
"time_offset": {
"start_offset": 17939000000,
"end_offset": 18013000000
},
"expected": {
"columns": [
"two_min_bucket",
"platform",
"cnt"
],
"results": [
[
"1786701840000000",
"Android",
"2"
]
],
"results_mode": "rowsort"
}
},
{
"id": "Q301",
"sql": "SELECT (_timestamp / 3600000000) * 3600000000 AS hour_bucket, COUNT(*) AS cnt, COUNT(DISTINCT visitor_session_id) AS users FROM \"{stream}\" WHERE action_category = 'performanceMetric' GROUP BY hour_bucket ORDER BY hour_bucket",
"category": "date_time",
"time_offset": {
"start_offset": 17999000000,
"end_offset": 18073000000
},
"expected": {
"columns": [
"hour_bucket",
"cnt",
"users"
],
"results": [
[
"1786701900000000.0",
"1",
"1"
],
[
"1786701912000000.0",
"1",
"1"
],
[
"1786701918000000.0",
"1",
"1"
],
[
"1786701936000000.0",
"1",
"1"
]
],
"results_mode": "rowsort",
"skip_sqllogictest": true
}
},
{
"id": "Q302",
"sql": "SELECT _timestamp, visitor_session_id, action_category, page_slug, latency_ms FROM \"{stream}\" WHERE _timestamp BETWEEN (_timestamp - 300000000) AND (_timestamp + 300000000) AND action_category = 'performanceMetric' ORDER BY latency_ms DESC LIMIT 10",
"category": "date_time",
"time_offset": {
"start_offset": 18059000000,
"end_offset": 18133000000
},
"expected": {
"columns": [
"visitor_session_id",
"action_category",
"page_slug",
"latency_ms"
],
"results": [
[
"sess_001",
"performanceMetric",
"itemPage",
"1900"
],
[
"sess_003",
"performanceMetric",
"itemPage",
"12"
]
],
"results_mode": "rowsort"
}
},
{
"id": "Q303",
"sql": "SELECT _timestamp, coalesce(page_url, page_slug) AS source, action_category, response_code, latency_ms FROM \"{stream}\" WHERE action_category = 'performanceMetric' AND latency_ms > 0 ORDER BY _timestamp DESC LIMIT 15",
"category": "date_time",
"time_offset": {
"start_offset": 18119000000,
"end_offset": 18193000000
},
"expected": {
"columns": [
"source",
"action_category",
"response_code",
"latency_ms"
],
"results": [
[
"https://shop.example.com/item/1003",
"performanceMetric",
"503",
"1450"
],
[
"https://shop.example.com/search?q=test",
"performanceMetric",
"500",
"230"
],
[
"searchPage",
"performanceMetric",
"500",
"230"
],
[
"https://shop.example.com/item/1001",
"performanceMetric",
"400",
"12"
],
[
"itemPage",
"performanceMetric",
"400",
"12"
]
],
"results_mode": "rowsort"
}
},
{
"id": "Q304",
"sql": "SELECT _timestamp, os_platform, action_category, page_slug, error_code FROM \"{stream}\" WHERE re_match(os_platform, 'Android|iPhone|iOS') AND page_slug IN ('itemPage', 'cartPage') AND action_category IN ('navigation', 'performanceMetric', 'interaction') ORDER BY _timestamp ASC LIMIT 25",
"category": "date_time",
"time_offset": {
"start_offset": 18179000000,
"end_offset": 18253000000
},
"expected": {
"columns": [
"os_platform",
"action_category",
"page_slug",
"error_code"
],
"results": [
[
"Android 12",
"performanceMetric",
"cartPage",
"E004"
],
[
"Android 12",
"performanceMetric",
"cartPage",
"E004"
],
[
"Mac OS X (iPhone)",
"performanceMetric",
"itemPage",
"E005"
],
[
"Android 14",
"interaction",
"itemPage",
"E007"
]
],
"results_mode": "rowsort"
}
},
{
"id": "Q305",
"sql": "SELECT (_timestamp / 3600000000) * 3600000000 AS hour_slot, page_slug, COUNT(*) AS cnt FROM \"{stream}\" WHERE action_category = 'navigation' GROUP BY hour_slot, page_slug ORDER BY hour_slot, cnt DESC",
"category": "date_time",
"time_offset": {
"start_offset": 18239000000,
"end_offset": 18313000000
},
"expected": {
"columns": [
"hour_slot",
"page_slug",
"cnt"
],
"results": [
[
"1786702176000000.0",
"homePage",
"1"
]
],
"results_mode": "rowsort",
"skip_sqllogictest": true
}
},
{
"id": "Q453",
"sql": "SELECT (_timestamp / 3600000000) * 3600000000 AS hour_bucket, action_category, COUNT(*) AS cnt FROM \"{stream}\" WHERE action_category IS NOT NULL GROUP BY hour_bucket, action_category ORDER BY hour_bucket ASC, cnt DESC",
"category": "date_time",
"time_offset": {
"start_offset": 27119000000,
"end_offset": 27193000000
},
"expected": {
"columns": [
"hour_bucket",
"action_category",
"cnt"
],
"results": [
[
"1786711020000000.0",
"interaction",
"1"
],
[
"1786711032000000.0",
"performanceMetric",
"1"
],
[
"1786711038000000.0",
"performanceMetric",
"1"
],
[
"1786711056000000.0",
"navigation",
"1"
],
[
"1786711074000000.0",
"performanceMetric",
"1"
],
[
"1786711080000000.0",
"performanceMetric",
"1"
],
[
"1786711092000000.0",
"performanceMetric",
"1"
]
],
"results_mode": "rowsort",
"skip_sqllogictest": true
}
},
{
"id": "Q454",
"sql": "SELECT (_timestamp / 60000000) * 60000000 AS minute_bucket, COUNT(*) AS cnt, COUNT(DISTINCT visitor_session_id) AS users FROM \"{stream}\" WHERE action_category = 'performanceMetric' GROUP BY minute_bucket ORDER BY minute_bucket ASC",
"category": "date_time",
"time_offset": {
"start_offset": 27179000000,
"end_offset": 27253000000
},
"expected": {
"columns": [
"minute_bucket",
"cnt",
"users"
],
"results": [
[
"1786711080000000.0",
"1",
"1"
],
[
"1786711092000000.0",
"1",
"1"
],
[
"1786711098000000.0",
"1",
"1"
],
[
"1786711116000000.0",
"1",
"1"
],
[
"1786711134000000.0",
"1",
"1"
],
[
"1786711140000000.0",
"1",
"1"
]
],
"results_mode": "rowsort",
"skip_sqllogictest": true
}
},
{
"id": "Q455",
"sql": "SELECT _timestamp, action_category, page_slug FROM \"{stream}\" WHERE action_category = 'performanceMetric' ORDER BY _timestamp ASC LIMIT 10 OFFSET 2",
"category": "date_time",
"time_offset": {
"start_offset": 27239000000,
"end_offset": 27313000000
},
"expected": {
"columns": [
"action_category",
"page_slug"
],
"results": [
[
"performanceMetric",
"itemPage"
]
],
"results_mode": "rowsort"
}
},
{
"id": "Q456",
"sql": "SELECT (CASE WHEN _timestamp % 60000000 < 30000000 THEN 'first_half' ELSE 'second_half' END) AS half_of_minute, COUNT(*) AS cnt FROM \"{stream}\" WHERE action_category = 'performanceMetric' GROUP BY half_of_minute ORDER BY half_of_minute ASC",
"category": "date_time",
"time_offset": {
"start_offset": 27299000000,
"end_offset": 27373000000
},
"expected": {
"columns": [
"half_of_minute",
"cnt"
],
"results": [
[
"first_half",
"2"
],
[
"second_half",
"1"
]
],
"results_mode": "rowsort"
}
},
{
"id": "Q457",
"sql": "SELECT _timestamp, (LEAD(_timestamp) OVER (ORDER BY _timestamp) - _timestamp) / 1000 AS gap_ms FROM \"{stream}\" WHERE action_category = 'navigation' ORDER BY _timestamp ASC LIMIT 10",
"category": "date_time",
"time_offset": {
"start_offset": 27359000000,
"end_offset": 27433000000
},
"expected": {
"skip_sqllogictest": true,
"skip_row_count": true,
"skip_column_check": true,
"columns": [
"gap_ms"
]
}
},
{
"id": "Q458",
"sql": "SELECT page_slug, MIN(_timestamp) AS first_seen, MAX(_timestamp) AS last_seen, (MAX(_timestamp) - MIN(_timestamp)) / 1000000 AS duration_seconds FROM \"{stream}\" WHERE action_category = 'performanceMetric' AND page_slug IS NOT NULL GROUP BY page_slug ORDER BY duration_seconds DESC, page_slug ASC",
"category": "date_time",
"time_offset": {
"start_offset": 27419000000,
"end_offset": 27493000000
},
"expected": {
"columns": [
"page_slug",
"first_seen",
"last_seen",
"duration_seconds"
],
"results": [
[
"itemPage",
"1786711320000000",
"1786711392000000",
"72.0"
],
[
"checkoutPage",
"1786711332000000",
"1786711338000000",
"6.0"
]
],
"results_mode": "rowsort"
}
},
{
"id": "Q459",
"sql": "SELECT _timestamp, page_slug, (ROW_NUMBER() OVER (PARTITION BY page_slug ORDER BY _timestamp) - 1) * 18000 AS ms_since_first FROM \"{stream}\" WHERE action_category = 'performanceMetric' AND page_slug IS NOT NULL ORDER BY page_slug ASC, _timestamp ASC LIMIT 15",
"category": "date_time",
"time_offset": {
"start_offset": 27479000000,
"end_offset": 27553000000
},
"expected": {
"columns": [
"page_slug",
"ms_since_first"
],
"results": [
[
"itemPage",
"0"
],
[
"itemPage",
"18000"
],
[
"itemPage",
"36000"
],
[
"itemPage",
"54000"
]
],
"results_mode": "rowsort"
}
},
{
"id": "Q460",
"sql": "SELECT _timestamp, action_category, page_slug, visitor_session_id FROM \"{stream}\" WHERE action_category = 'navigation' ORDER BY _timestamp ASC LIMIT 5 OFFSET 0",
"category": "date_time",
"time_offset": {
"start_offset": 27539000000,
"end_offset": 27613000000
},
"expected": {
"columns": [
"action_category",
"page_slug",
"visitor_session_id"
],
"results": [
[
"navigation",
"itemPage",
"sess_005"
],
[
"navigation",
"itemPage",
"sess_005"
]
],
"results_mode": "rowsort"
}
},
{
"id": "Q521",
"sql": "SELECT _timestamp, _timestamp - arrow_cast(360000000, 'Int64') AS earlier_ts, _timestamp + arrow_cast(60000000, 'Int64') AS later_ts, latency_ms FROM \"{stream}\" ORDER BY _timestamp ASC LIMIT 10",
"category": "date_time",
"time_offset": {
"start_offset": 31199000000,
"end_offset": 31273000000
},
"expected": {
"row_count": 7,
"columns": [
"_timestamp",
"earlier_ts",
"later_ts",
"latency_ms"
],
"note": "arrow_cast() is OO-specific (DataFusion); DuckDB cannot replicate",
"skip_sqllogictest": true
}
},
{
"id": "Q522",
"sql": "SELECT (_timestamp / 60000000) * 60000000 AS minute_bucket, COUNT(*) AS cnt, MAX(latency_ms) AS max_latency FROM \"{stream}\" GROUP BY minute_bucket ORDER BY minute_bucket ASC",
"category": "date_time",
"time_offset": {
"start_offset": 31259000000,
"end_offset": 31333000000
},
"expected": {
"columns": [
"minute_bucket",
"cnt",
"max_latency"
],
"results": [
[
"1786715160000000.0",
"1",
"3200"
],
[
"1786715172000000.0",
"1",
"78"
],
[
"1786715178000000.0",
"1",
"78"
],
[
"1786715196000000.0",
"1",
"1900"
],
[
"1786715214000000.0",
"1",
"15"
],
[
"1786715220000000.0",
"1",
"15"
],
[
"1786715232000000.0",
"1",
"12"
]
],
"results_mode": "rowsort",
"skip_sqllogictest": true,
"skip_row_count": true
}
},
{
"id": "Q523",
"sql": "SELECT _timestamp, to_timestamp_micros(_timestamp + latency_ms * 1000) AS adjusted_ts, latency_ms FROM \"{stream}\" ORDER BY _timestamp ASC LIMIT 5",
"category": "date_time",
"time_offset": {
"start_offset": 31319000000,
"end_offset": 31393000000
},
"expected": {
"row_count": 5,
"columns": [
"_timestamp",
"adjusted_ts",
"latency_ms"
],
"note": "to_timestamp_micros() is OO-specific (DataFusion); DuckDB cannot replicate",
"skip_sqllogictest": true
}
},
{
"id": "Q524",
"sql": "SELECT (_timestamp / 30000000) * 30000000 AS thirty_sec_bucket, COUNT(*) AS cnt, MIN(latency_ms) AS min_lat, MAX(latency_ms) AS max_lat FROM \"{stream}\" GROUP BY thirty_sec_bucket ORDER BY thirty_sec_bucket ASC",
"category": "date_time",
"time_offset": {
"start_offset": 31379000000,
"end_offset": 31453000000
},
"expected": {
"columns": [
"thirty_sec_bucket",
"cnt",
"min_lat",
"max_lat"
],
"results": [
[
"1786715280000000.0",
"1",
"230",
"230"
],
[
"1786715292000000.0",
"1",
"1450",
"1450"
],
[
"1786715298000000.0",
"1",
"1450",
"1450"
],
[
"1786715316000000.0",
"1",
"89",
"89"
],
[
"1786715334000000.0",
"1",
"567",
"567"
],
[
"1786715340000000.0",
"1",
"567",
"567"
],
[
"1786715352000000.0",
"1",
"3200",
"3200"
]
],
"results_mode": "rowsort",
"skip_sqllogictest": true,
"skip_row_count": true
}
},
{
"id": "Q525",
"sql": "SELECT _timestamp, _timestamp - (_timestamp % 60000000) AS rounded_minute, latency_ms, throughput_rate FROM \"{stream}\" WHERE latency_ms > 100 ORDER BY _timestamp ASC LIMIT 10",
"category": "date_time",
"time_offset": {
"start_offset": 31439000000,
"end_offset": 31513000000
},
"expected": {
"columns": [
"rounded_minute",
"latency_ms",
"throughput_rate"
],
"results": [
[
"1786715340000000",
"567",
"290.0"
],
[
"1786715340000000",
"3200",
"555.0"
],
[
"1786715340000000",
"3200",
"555.0"
],
[
"1786715340000000",
"1900",
"900.0"
],
[
"1786715400000000",
"1900",
"900.0"
]
],
"results_mode": "rowsort"
}
},
{
"id": "Q526",
"sql": "SELECT _timestamp, CAST((_timestamp - LAG(_timestamp) OVER (ORDER BY _timestamp)) AS BIGINT) / 1000 AS gap_ms, latency_ms FROM \"{stream}\" ORDER BY _timestamp ASC LIMIT 5",
"category": "date_time",
"time_offset": {
"start_offset": 31499000000,
"end_offset": 31573000000
},
"expected": {
"columns": [
"gap_ms",
"latency_ms"
],
"results": [
[
"None",
"1900"
],
[
"12000.0",
"15"
],
[
"6000.0",
"15"
],
[
"18000.0",
"12"
],
[
"18000.0",
"45"
]
],
"results_mode": "rowsort",
"skip_sqllogictest": true,
"skip_row_count": true,
"skip_column_check": true
}
},
{
"id": "Q878",
"sql": "SELECT _timestamp, (_timestamp / 60000000) * 60000000 AS minute_trunc, (_timestamp / 30000000) * 30000000 AS thirty_sec_bucket, latency_ms FROM \"{stream}\" WHERE latency_ms IS NOT NULL ORDER BY _timestamp ASC LIMIT 10",
"category": "date_time",
"time_offset": {
"start_offset": 52619000000,
"end_offset": 52693000000
},
"expected": {
"columns": [
"minute_trunc",
"thirty_sec_bucket",
"latency_ms"
],
"results": [
[
"1786736520000000.0",
"1786736520000000.0",
"89"
],
[
"1786736532000000.0",
"1786736532000000.0",
"567"
],
[
"1786736538000000.0",
"1786736538000000.0",
"567"
],
[
"1786736556000000.0",
"1786736556000000.0",
"3200"
],
[
"1786736574000000.0",
"1786736574000000.0",
"78"
],
[
"1786736580000000.0",
"1786736580000000.0",
"78"
],
[
"1786736592000000.0",
"1786736592000000.0",
"1900"
]
],
"results_mode": "rowsort",
"skip_sqllogictest": true
}
},
{
"id": "Q879",
"sql": "SELECT (_timestamp / 60000000) * 60000000 AS minute_bucket, COUNT(*) AS cnt, AVG(latency_ms) AS avg_lat, MAX(latency_ms) AS max_lat FROM \"{stream}\" WHERE latency_ms IS NOT NULL GROUP BY minute_bucket ORDER BY minute_bucket ASC",
"category": "date_time",
"time_offset": {
"start_offset": 52679000000,
"end_offset": 52753000000
},
"expected": {
"columns": [
"minute_bucket",
"cnt",
"avg_lat",
"max_lat"
],
"results": [
[
"1786736580000000.0",
"1",
"78.0",
"78"
],
[
"1786736592000000.0",
"1",
"1900.0",
"1900"
],
[
"1786736598000000.0",
"1",
"1900.0",
"1900"
],
[
"1786736616000000.0",
"1",
"15.0",
"15"
],
[
"1786736634000000.0",
"1",
"12.0",
"12"
],
[
"1786736640000000.0",
"1",
"12.0",
"12"
],
[
"1786736652000000.0",
"1",
"45.0",
"45"
]
],
"results_mode": "rowsort",
"skip_sqllogictest": true,
"skip_row_count": true,
"skip_column_check": true
}
},
{
"id": "Q880",
"sql": "SELECT _timestamp, to_timestamp_micros(_timestamp) AS ts_converted, latency_ms FROM \"{stream}\" ORDER BY _timestamp ASC LIMIT 10",
"category": "date_time",
"time_offset": {
"start_offset": 52739000000,
"end_offset": 52813000000
},
"expected": {
"skip_sqllogictest": true
}
},
{
"id": "Q881",
"sql": "SELECT _timestamp, _timestamp + arrow_cast(3600000000, 'Int64') AS future_ts, _timestamp - arrow_cast(3600000000, 'Int64') AS past_ts FROM \"{stream}\" ORDER BY _timestamp ASC LIMIT 10",
"category": "date_time",
"time_offset": {
"start_offset": 52799000000,
"end_offset": 52873000000
},
"expected": {
"skip_sqllogictest": true
}
},
{
"id": "Q882",
"sql": "SELECT _timestamp, (_timestamp - LAG(_timestamp) OVER (ORDER BY _timestamp)) / 1000 AS gap_ms FROM \"{stream}\" ORDER BY _timestamp ASC LIMIT 10",
"category": "date_time",
"time_offset": {
"start_offset": 52859000000,
"end_offset": 52933000000
},
"expected": {
"columns": [
"gap_ms"
],
"results": [
[
"None"
],
[
"12000.0"
],
[
"6000.0"
],
[
"18000.0"
],
[
"18000.0"
],
[
"6000.0"
],
[
"12000.0"
]
],
"results_mode": "rowsort",
"skip_sqllogictest": true,
"skip_row_count": true,
"skip_column_check": true
}
},
{
"id": "Q883",
"sql": "SELECT _timestamp, (_timestamp / 3600000000) * 3600000000 AS hour_bucket, COUNT(*) OVER (PARTITION BY (_timestamp / 3600000000) * 3600000000) AS cnt_in_hour, throughput_rate FROM \"{stream}\" ORDER BY _timestamp ASC LIMIT 10",
"category": "date_time",
"time_offset": {
"start_offset": 52919000000,
"end_offset": 52993000000
},
"expected": {
"columns": [
"hour_bucket",
"cnt_in_hour",
"throughput_rate"
],
"results": [
[
"1786736820000000.0",
"1",
"150.0"
],
[
"1786736832000000.0",
"1",
"320.0"
],
[
"1786736838000000.0",
"1",
"320.0"
],
[
"1786736856000000.0",
"1",
"480.0"
],
[
"1786736874000000.0",
"1",
"610.0"
],
[
"1786736880000000.0",
"1",
"610.0"
],
[
"1786736892000000.0",
"1",
"725.0"
]
],
"results_mode": "rowsort",
"skip_sqllogictest": true
}
},
{
"id": "Q884",
"sql": "SELECT (_timestamp / 60000000) * 60000000 AS minute_bucket, component_name, COUNT(*) AS cnt, AVG(CAST(latency_ms AS FLOAT)) AS avg_lat FROM \"{stream}\" WHERE latency_ms IS NOT NULL GROUP BY minute_bucket, component_name ORDER BY minute_bucket ASC, cnt DESC LIMIT 15",
"category": "date_time",
"time_offset": {
"start_offset": 52979000000,
"end_offset": 53053000000
},
"expected": {
"columns": [
"minute_bucket",
"component_name",
"cnt",
"avg_lat"
],
"results": [
[
"1786736880000000.0",
"track-router",
"1",
"230.0"
],
[
"1786736892000000.0",
"batch-sync",
"1",
"1450.0"
],
[
"1786736898000000.0",
"batch-sync",
"1",
"1450.0"
],
[
"1786736916000000.0",
"pallet-mapper",
"1",
"89.0"
],
[
"1786736934000000.0",
"lane-monitor",
"1",
"567.0"
],
[
"1786736940000000.0",
"lane-monitor",
"1",
"567.0"
],
[
"1786736952000000.0",
"temp-regulator",
"1",
"3200.0"
]
],
"results_mode": "rowsort",
"skip_sqllogictest": true
}
},
{
"id": "Q885",
"sql": "SELECT _timestamp, _timestamp - (_timestamp % 30000000) AS aligned_30s, lead(_timestamp, 1) OVER (ORDER BY _timestamp) - _timestamp AS lead_gap FROM \"{stream}\" ORDER BY _timestamp ASC LIMIT 10",
"category": "date_time",
"time_offset": {
"start_offset": 53039000000,
"end_offset": 53113000000
},
"expected": {
"columns": [
"aligned_30s",
"lead_gap"
],
"results": [
[
"1786736940000000",
"12000000"
],
[
"1786736940000000",
"6000000"
],
[
"1786736940000000",
"18000000"
],
[
"1786736970000000",
"18000000"
],
[
"1786736970000000",
"6000000"
],
[
"1786737000000000",
"12000000"
],
[
"1786737000000000",
"None"
]
],
"results_mode": "rowsort",
"skip_sqllogictest": true,
"skip_row_count": true,
"skip_column_check": true
}
},
{
"id": "Q886",
"sql": "SELECT EXTRACT(HOUR FROM to_timestamp_micros(_timestamp)) AS hour_of_day, COUNT(*) AS cnt FROM \"{stream}\" GROUP BY hour_of_day ORDER BY hour_of_day",
"category": "date_time",
"time_offset": {
"start_offset": 53099000000,
"end_offset": 53173000000
},
"expected": {
"skip_sqllogictest": true
}
},
{
"id": "Q887",
"sql": "SELECT _timestamp, _timestamp / 1000000 AS epoch_seconds, (_timestamp / 1000000) % 60 AS second_of_minute FROM \"{stream}\" ORDER BY _timestamp ASC LIMIT 10",
"category": "date_time",
"time_offset": {
"start_offset": 53159000000,
"end_offset": 53233000000
},
"expected": {
"columns": [
"epoch_seconds",
"second_of_minute"
],
"results": [
[
"1786737060.0",
"0.0"
],
[
"1786737072.0",
"12.0"
],
[
"1786737078.0",
"18.0"
],
[
"1786737096.0",
"36.0"
],
[
"1786737114.0",
"54.0"
],
[
"1786737120.0",
"0.0"
],
[
"1786737132.0",
"12.0"
]
],
"results_mode": "rowsort"
}
},
{
"id": "Q888",
"sql": "SELECT (_timestamp / 3600000000) * 3600000000 AS hour_bucket, COUNT(*) AS cnt, SUM(throughput_rate) AS total_rate FROM \"{stream}\" GROUP BY hour_bucket ORDER BY hour_bucket ASC",
"category": "date_time",
"time_offset": {
"start_offset": 53219000000,
"end_offset": 53293000000
},
"expected": {
"columns": [
"hour_bucket",
"cnt",
"total_rate"
],
"results": [
[
"1786737120000000.0",
"1",
"840.0"
],
[
"1786737132000000.0",
"1",
"290.0"
],
[
"1786737138000000.0",
"1",
"290.0"
],
[
"1786737156000000.0",
"1",
"555.0"
],
[
"1786737174000000.0",
"1",
"190.0"
],
[
"1786737180000000.0",
"1",
"190.0"
],
[
"1786737192000000.0",
"1",
"900.0"
]
],
"results_mode": "rowsort",
"skip_sqllogictest": true,
"skip_row_count": true,
"skip_column_check": true
}
},
{
"id": "Q889",
"sql": "SELECT _timestamp, (_timestamp / 1000000) * 1000000 AS second_trunc, latency_ms, throughput_rate FROM \"{stream}\" WHERE throughput_rate > 200 ORDER BY _timestamp ASC LIMIT 10",
"category": "date_time",
"time_offset": {
"start_offset": 53279000000,
"end_offset": 53353000000
},
"expected": {
"columns": [
"second_trunc",
"latency_ms",
"throughput_rate"
],
"results": [
[
"1786737192000000.0",
"1900",
"900.0"
],
[
"1786737198000000.0",
"1900",
"900.0"
],
[
"1786737234000000.0",
"12",
"320.0"
],
[
"1786737240000000.0",
"12",
"320.0"
],
[
"1786737252000000.0",
"45",
"480.0"
]
],
"results_mode": "rowsort",
"skip_sqllogictest": true
}
},
{
"id": "Q890",
"sql": "SELECT (_timestamp / 15000000) * 15000000 AS fifteen_sec_bucket, facility_zone, COUNT(*) AS cnt FROM \"{stream}\" GROUP BY fifteen_sec_bucket, facility_zone ORDER BY fifteen_sec_bucket ASC LIMIT 15",
"category": "date_time",
"time_offset": {
"start_offset": 53339000000,
"end_offset": 53413000000
},
"expected": {
"columns": [
"fifteen_sec_bucket",
"facility_zone",
"cnt"
],
"results": [
[
"1786737240000000.0",
"ZONE-1",
"1"
],
[
"1786737252000000.0",
"ZONE-4",
"1"
],
[
"1786737258000000.0",
"ZONE-2",
"1"
],
[
"1786737276000000.0",
"ZONE-3",
"1"
],
[
"1786737294000000.0",
"ZONE-4",
"1"
],
[
"1786737300000000.0",
"ZONE-2",
"1"
],
[
"1786737312000000.0",
"ZONE-1",
"1"
]
],
"results_mode": "rowsort",
"skip_sqllogictest": true,
"skip_row_count": true,
"skip_column_check": true
}
},
{
"id": "Q891",
"sql": "SELECT _timestamp, to_timestamp_micros(_timestamp) AS ts_dt, arrow_cast(to_timestamp_micros(_timestamp), 'Timestamp(Nanosecond, None)') AS ts_ns FROM \"{stream}\" ORDER BY _timestamp ASC LIMIT 10",
"category": "date_time",
"time_offset": {
"start_offset": 53399000000,
"end_offset": 53473000000
},
"expected": {
"skip_sqllogictest": true
}
},
{
"id": "Q892",
"sql": "SELECT _timestamp, _timestamp - MIN(_timestamp) OVER () AS offset_from_start, throughput_rate FROM \"{stream}\" ORDER BY _timestamp ASC LIMIT 10",
"category": "date_time",
"time_offset": {
"start_offset": 53459000000,
"end_offset": 53533000000
},
"expected": {
"columns": [
"offset_from_start",
"throughput_rate"
],
"results": [
[
"0",
"555.0"
],
[
"12000000",
"190.0"
],
[
"18000000",
"190.0"
],
[
"36000000",
"900.0"
],
[
"54000000",
"150.0"
],
[
"60000000",
"150.0"
],
[
"72000000",
"320.0"
]
],
"results_mode": "rowsort"
}
},
{
"id": "Q893",
"sql": "SELECT _timestamp, (_timestamp / 60000000) * 60000000 AS minute_bucket, MAX(throughput_rate) OVER (PARTITION BY (_timestamp / 60000000) * 60000000) AS peak_in_minute FROM \"{stream}\" ORDER BY _timestamp ASC LIMIT 10",
"category": "date_time",
"time_offset": {
"start_offset": 53519000000,
"end_offset": 53593000000
},
"expected": {
"columns": [
"minute_bucket",
"peak_in_minute"
],
"results": [
[
"1786737420000000.0",
"150.0"
],
[
"1786737432000000.0",
"320.0"
],
[
"1786737438000000.0",
"320.0"
],
[
"1786737456000000.0",
"480.0"
],
[
"1786737474000000.0",
"610.0"
],
[
"1786737480000000.0",
"610.0"
],
[
"1786737492000000.0",
"725.0"
]
],
"results_mode": "rowsort",
"skip_sqllogictest": true,
"skip_row_count": true,
"skip_column_check": true
}
},
{
"id": "Q894",
"sql": "SELECT (_timestamp / 60000000) * 60000000 AS minute_bucket, COALESCE(operation_mode, 'unknown') AS mode, COUNT(*) AS cnt, AVG(throughput_rate) AS avg_rate FROM \"{stream}\" GROUP BY minute_bucket, mode ORDER BY minute_bucket ASC, cnt DESC LIMIT 15",
"category": "date_time",
"time_offset": {
"start_offset": 53579000000,
"end_offset": 53653000000
},
"expected": {
"columns": [
"minute_bucket",
"mode",
"cnt",
"avg_rate"
],
"results": [
[
"1786737480000000.0",
"auto",
"1",
"610.0"
],
[
"1786737492000000.0",
"hybrid",
"1",
"725.0"
],
[
"1786737498000000.0",
"manual",
"1",
"725.0"
],
[
"1786737516000000.0",
"hybrid",
"1",
"840.0"
],
[
"1786737534000000.0",
"auto",
"1",
"290.0"
],
[
"1786737540000000.0",
"auto",
"1",
"290.0"
],
[
"1786737552000000.0",
"manual",
"1",
"555.0"
]
],
"results_mode": "rowsort",
"skip_sqllogictest": true
}
},
{
"id": "Q895",
"sql": "SELECT _timestamp, _timestamp + (latency_ms * 1000) AS response_ts, latency_ms FROM \"{stream}\" WHERE latency_ms IS NOT NULL ORDER BY _timestamp ASC LIMIT 10",
"category": "date_time",
"time_offset": {
"start_offset": 53639000000,
"end_offset": 53713000000
},
"expected": {
"columns": [
"response_ts",
"latency_ms"
],
"results": [
[
"1786737540567000",
"567"
],
[
"1786737555200000",
"3200"
],
[
"1786737561200000",
"3200"
],
[
"1786737576078000",
"78"
],
[
"1786737595900000",
"1900"
],
[
"1786737601900000",
"1900"
],
[
"1786737612015000",
"15"
]
],
"results_mode": "rowsort"
}
},
{
"id": "Q896",
"sql": "SELECT (_timestamp / 120000000) * 120000000 AS two_min_bucket, COUNT(*) AS cnt, MAX(latency_ms) AS max_lat, MIN(latency_ms) AS min_lat FROM \"{stream}\" WHERE latency_ms IS NOT NULL GROUP BY two_min_bucket ORDER BY two_min_bucket ASC",
"category": "date_time",
"time_offset": {
"start_offset": 53699000000,
"end_offset": 53773000000
},
"expected": {
"columns": [
"two_min_bucket",
"cnt",
"max_lat",
"min_lat"
],
"results": [
[
"1786737600000000.0",
"1",
"1900",
"1900"
],
[
"1786737612000000.0",
"1",
"15",
"15"
],
[
"1786737618000000.0",
"1",
"15",
"15"
],
[
"1786737636000000.0",
"1",
"12",
"12"
],
[
"1786737654000000.0",
"1",
"45",
"45"
],
[
"1786737660000000.0",
"1",
"45",
"45"
],
[
"1786737672000000.0",
"1",
"230",
"230"
]
],
"results_mode": "rowsort",
"skip_sqllogictest": true,
"skip_row_count": true,
"skip_column_check": true
}
},
{
"id": "Q897",
"sql": "SELECT _timestamp, _timestamp / 1000000 AS epoch_seconds, (_timestamp / 1000000) / 60 AS epoch_minutes FROM \"{stream}\" ORDER BY _timestamp ASC LIMIT 10",
"category": "date_time",
"time_offset": {
"start_offset": 53759000000,
"end_offset": 53833000000
},
"expected": {
"columns": [
"epoch_seconds",
"epoch_minutes"
],
"results": [
[
"1786737660.0",
"29778961.0"
],
[
"1786737672.0",
"29778961.2"
],
[
"1786737678.0",
"29778961.3"
],
[
"1786737696.0",
"29778961.6"
],
[
"1786737714.0",
"29778961.9"
],
[
"1786737720.0",
"29778962.0"
],
[
"1786737732.0",
"29778962.2"
]
],
"results_mode": "rowsort"
}
},
{
"id": "Q898",
"sql": "SELECT (_timestamp / 1000000) * 1000000 AS second_bucket, COUNT(*) AS cnt FROM \"{stream}\" GROUP BY second_bucket ORDER BY cnt DESC LIMIT 10",
"category": "date_time",
"time_offset": {
"start_offset": 53819000000,
"end_offset": 53893000000
},
"expected": {
"columns": [
"second_bucket",
"cnt"
],
"results": [
[
"1786737756000000.0",
"1"
],
[
"1786737774000000.0",
"1"
],
[
"1786737732000000.0",
"1"
],
[
"1786737738000000.0",
"1"
],
[
"1786737792000000.0",
"1"
],
[
"1786737720000000.0",
"1"
],
[
"1786737780000000.0",
"1"
]
],
"results_mode": "rowsort",
"skip_sqllogictest": true
}
},
{
"id": "Q899",
"sql": "WITH time_data AS (SELECT _timestamp, _timestamp - MIN(_timestamp) OVER () AS rel_time, throughput_rate FROM \"{stream}\") SELECT _timestamp, rel_time / 1000 AS rel_ms, throughput_rate FROM time_data ORDER BY _timestamp ASC LIMIT 10",
"category": "date_time",
"time_offset": {
"start_offset": 53879000000,
"end_offset": 53953000000
},
"expected": {
"columns": [
"rel_ms",
"throughput_rate"
],
"results": [
[
"0.0",
"190.0"
],
[
"12000.0",
"900.0"
],
[
"18000.0",
"900.0"
],
[
"36000.0",
"150.0"
],
[
"54000.0",
"320.0"
],
[
"60000.0",
"320.0"
],
[
"72000.0",
"480.0"
]
],
"results_mode": "rowsort"
}
},
{
"id": "Q900",
"sql": "SELECT _timestamp, _timestamp - LAG(_timestamp) OVER (PARTITION BY component_name ORDER BY _timestamp) AS comp_gap, component_name, latency_ms FROM \"{stream}\" WHERE latency_ms IS NOT NULL ORDER BY component_name, _timestamp ASC LIMIT 10",
"category": "date_time",
"time_offset": {
"start_offset": 53939000000,
"end_offset": 54013000000
},
"expected": {
"columns": [
"comp_gap",
"component_name",
"latency_ms"
],
"results": [
[
"None",
"batch-sync",
"1450"
],
[
"6000000",
"batch-sync",
"1450"
],
[
"None",
"pallet-mapper",
"89"
],
[
"None",
"scan-hub",
"45"
],
[
"6000000",
"scan-hub",
"45"
],
[
"None",
"track-router",
"230"
],
[
"None",
"zone-controller",
"12"
]
],
"results_mode": "rowsort",
"skip_sqllogictest": true,
"skip_row_count": true,
"skip_column_check": true
}
}
],
"last_query_id": 73
}