Skip to content

Commit 0866684

Browse files
STWMichaelSTWang
andauthored
Migrate Clickhouse and ASAP manual benchmarking folder to new repo (#196)
* move benchmark folder * fix path * fix path * fix path --------- Co-authored-by: STWang <STWang@node0.stwang-295416.cloudmigration-pg0.utah.cloudlab.us>
1 parent 03515e6 commit 0866684

14 files changed

Lines changed: 1657 additions & 81 deletions

File tree

asap-tools/execution-utilities/.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,6 @@
77

88
clickhouse-benchmark-pipeline/benchmark_results/
99
**/data/
10+
11+
**/*.csv
12+
**/*.png
Lines changed: 205 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,205 @@
1+
# ASAP Benchmark: ClickBench `hits` Dataset
2+
3+
Measures ASAP query latency (KLL sketch) against 50 fixed-timestamp QUANTILE 0.95 queries over 1M ClickBench rows.
4+
5+
## Data Flow
6+
7+
```
8+
hits.json.gz
9+
└─> data_exporter (sort by EventTime → Kafka hits topic)
10+
|
11+
┌────────────────┴────────────────┐
12+
↓ ↓
13+
Arroyo (KLL sketch, 1-sec windows) ClickHouse (Kafka engine)
14+
|
15+
sketch_topic (Kafka)
16+
|
17+
QueryEngineRust :8088
18+
|
19+
run_benchmark.py → asap_results.csv
20+
```
21+
22+
---
23+
24+
## Prerequisites
25+
26+
```bash
27+
export INSTALL_DIR=/scratch/sketch_db_for_prometheus
28+
```
29+
30+
### Build binaries (one-time)
31+
32+
```bash
33+
# QueryEngineRust
34+
cd ~/ASAPQuery/asap-query-engine && cargo build --release
35+
36+
# data_exporter
37+
cd ~/ASAPQuery/asap-tools/execution-utilities/clickhouse-benchmark-pipeline/data_exporter
38+
cargo build --release
39+
```
40+
41+
### Download and chunk ClickBench data (one-time)
42+
43+
```bash
44+
cd ~/ASAPQuery/asap-tools/execution-utilities/clickhouse-benchmark-pipeline
45+
python3 benchmark_importer/download_data.py
46+
47+
DATA_DIR=~/ASAPQuery/asap-tools/execution-utilities/clickhouse-benchmark-pipeline/benchmark_importer/data
48+
cd $DATA_DIR
49+
mv hits.json.gz hits_full.json.gz
50+
zcat hits_full.json.gz | head -n 1000000 | gzip > hits.json.gz
51+
```
52+
53+
### Python dependencies (one-time)
54+
55+
```bash
56+
pip3 install --user requests matplotlib numpy
57+
pip3 install --user ~/ASAPQuery/asap-common/dependencies/py/promql_utilities/
58+
```
59+
60+
---
61+
62+
## Run the Pipeline
63+
64+
**Order matters**: create the Arroyo pipeline before producing data (connection table uses `offset: latest`).
65+
66+
### Step 1 — Start Kafka
67+
68+
```bash
69+
~/ASAPQuery/asap-tools/installation/kafka/run.sh $INSTALL_DIR/kafka
70+
```
71+
72+
### Step 2 — Create Kafka topics
73+
74+
```bash
75+
KAFKA=$INSTALL_DIR/kafka/bin
76+
$KAFKA/kafka-topics.sh --bootstrap-server localhost:9092 --create \
77+
--topic hits --partitions 1 --replication-factor 1
78+
$KAFKA/kafka-topics.sh --bootstrap-server localhost:9092 --create \
79+
--topic sketch_topic --partitions 1 --replication-factor 1 \
80+
--config max.message.bytes=20971520
81+
```
82+
83+
### Step 3 — Start ClickHouse
84+
85+
```bash
86+
~/ASAPQuery/asap-tools/installation/clickhouse/run.sh $INSTALL_DIR
87+
```
88+
89+
### Step 4 — Init ClickHouse tables
90+
91+
```bash
92+
cd ~/ASAPQuery/asap-tools/execution-utilities/clickhouse-benchmark-pipeline
93+
CLICKHOUSE_BIN=$INSTALL_DIR/clickhouse bash scripts/init_clickhouse.sh
94+
```
95+
96+
### Step 5 — Start Arroyo cluster
97+
98+
```bash
99+
~/ASAPQuery/asap-sketch-ingest/target/release/arroyo \
100+
--config ~/ASAPQuery/asap-sketch-ingest/config.yaml cluster \
101+
> /tmp/arroyo.log 2>&1 &
102+
```
103+
104+
### Step 6 — Create ArroyoSketch pipeline
105+
106+
```bash
107+
cd ~/ASAPQuery/asap-sketch-ingest
108+
python3 run_arroyosketch.py \
109+
--source_type kafka \
110+
--kafka_input_format json \
111+
--input_kafka_topic hits \
112+
--output_format json \
113+
--pipeline_name asap_hits_pipeline \
114+
--config_file_path ~/ASAPQuery/asap-tools/execution-utilities/asap_query_latency/streaming_config.yaml \
115+
--output_kafka_topic sketch_topic \
116+
--output_dir ./outputs \
117+
--parallelism 1 \
118+
--query_language sql
119+
```
120+
121+
### Step 7 — Start QueryEngineRust
122+
123+
```bash
124+
cd ~/ASAPQuery/asap-query-engine
125+
nohup ./target/release/query_engine_rust \
126+
--kafka-topic sketch_topic --input-format json \
127+
--config ~/ASAPQuery/asap-tools/execution-utilities/asap_query_latency/inference_config.yaml \
128+
--streaming-config ~/ASAPQuery/asap-tools/execution-utilities/asap_query_latency/streaming_config.yaml \
129+
--http-port 8088 --delete-existing-db --log-level DEBUG \
130+
--output-dir ./output --streaming-engine arroyo \
131+
--query-language SQL --lock-strategy per-key \
132+
--prometheus-scrape-interval 1 > /tmp/query_engine.log 2>&1 &
133+
```
134+
135+
### Step 8 — Produce ClickBench data
136+
137+
`data_exporter` reads all 1M records, transforms them (RFC3339 EventTime, stringify integer fields), sorts by EventTime, then sends to Kafka with event-time Kafka timestamps. This enables Arroyo's watermark to advance correctly for event-time windowing.
138+
139+
```bash
140+
cd ~/ASAPQuery/asap-tools/execution-utilities/clickhouse-benchmark-pipeline
141+
TOTAL_RECORDS=1000000 DATA_MODE=clickbench bash scripts/generate_data.sh
142+
```
143+
144+
Wait for completion before running the benchmark.
145+
146+
### Step 9 — Run ASAP benchmark
147+
148+
```bash
149+
cd ~/ASAPQuery/asap-tools/execution-utilities/asap_query_latency
150+
./run_benchmark.py \
151+
--mode asap \
152+
--sql-file asap_quantile_queries.sql \
153+
--output asap_results.csv
154+
```
155+
156+
### Step 10 — Run baseline benchmark (ClickHouse)
157+
158+
Wait for Step 8 data ingestion to complete, then verify ClickHouse has all rows:
159+
160+
```bash
161+
$INSTALL_DIR/clickhouse client --query "SELECT count(*) FROM hits"
162+
# Should return 1000000
163+
```
164+
165+
Run the benchmark:
166+
167+
```bash
168+
cd ~/ASAPQuery/asap-tools/execution-utilities/asap_query_latency
169+
./run_benchmark.py \
170+
--mode baseline \
171+
--sql-file clickhouse_quantile_queries.sql \
172+
--output baseline_results.csv \
173+
--clickhouse-url http://localhost:8123
174+
```
175+
176+
---
177+
178+
## Reset (re-run from scratch)
179+
180+
```bash
181+
# Kill workers and Arroyo cluster
182+
pkill -f "arroyo"; pkill -f "query_engine_rust"; pkill -f "data_exporter"
183+
sleep 2
184+
185+
# Stop Kafka and ClickHouse
186+
pkill -f "kafka-server-start.sh"; pkill -f "clickhouse server"
187+
sleep 2
188+
189+
# Clear Arroyo checkpoint state (REQUIRED — old watermark causes all windows to be skipped)
190+
rm -rf /tmp/arroyo/
191+
192+
# Delete Kafka topics
193+
KAFKA=$INSTALL_DIR/kafka/bin
194+
$KAFKA/kafka-topics.sh --bootstrap-server localhost:9092 --delete --topic hits
195+
$KAFKA/kafka-topics.sh --bootstrap-server localhost:9092 --delete --topic sketch_topic
196+
197+
# Delete old Arroyo pipeline
198+
cd ~/ASAPQuery/asap-sketch-ingest
199+
python3 delete_pipeline.py --all_pipelines
200+
201+
# Clear ClickHouse table
202+
$INSTALL_DIR/clickhouse client --query "TRUNCATE TABLE hits"
203+
```
204+
205+
Then repeat Steps 1–9.
Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
-- T000: quantile window ending at 2013-07-14 20:00:00
2+
SELECT QUANTILE(0.95, ResolutionWidth) FROM hits WHERE EventTime BETWEEN DATEADD(s, -10, '2013-07-14 20:00:00') AND '2013-07-14 20:00:00' GROUP BY RegionID, OS, UserAgent, TraficSourceID;
3+
-- T001: quantile window ending at 2013-07-14 20:30:00
4+
SELECT QUANTILE(0.95, ResolutionWidth) FROM hits WHERE EventTime BETWEEN DATEADD(s, -10, '2013-07-14 20:30:00') AND '2013-07-14 20:30:00' GROUP BY RegionID, OS, UserAgent, TraficSourceID;
5+
-- T002: quantile window ending at 2013-07-14 21:00:00
6+
SELECT QUANTILE(0.95, ResolutionWidth) FROM hits WHERE EventTime BETWEEN DATEADD(s, -10, '2013-07-14 21:00:00') AND '2013-07-14 21:00:00' GROUP BY RegionID, OS, UserAgent, TraficSourceID;
7+
-- T003: quantile window ending at 2013-07-14 21:30:00
8+
SELECT QUANTILE(0.95, ResolutionWidth) FROM hits WHERE EventTime BETWEEN DATEADD(s, -10, '2013-07-14 21:30:00') AND '2013-07-14 21:30:00' GROUP BY RegionID, OS, UserAgent, TraficSourceID;
9+
-- T004: quantile window ending at 2013-07-14 22:00:00
10+
SELECT QUANTILE(0.95, ResolutionWidth) FROM hits WHERE EventTime BETWEEN DATEADD(s, -10, '2013-07-14 22:00:00') AND '2013-07-14 22:00:00' GROUP BY RegionID, OS, UserAgent, TraficSourceID;
11+
-- T005: quantile window ending at 2013-07-14 22:30:00
12+
SELECT QUANTILE(0.95, ResolutionWidth) FROM hits WHERE EventTime BETWEEN DATEADD(s, -10, '2013-07-14 22:30:00') AND '2013-07-14 22:30:00' GROUP BY RegionID, OS, UserAgent, TraficSourceID;
13+
-- T006: quantile window ending at 2013-07-14 23:00:00
14+
SELECT QUANTILE(0.95, ResolutionWidth) FROM hits WHERE EventTime BETWEEN DATEADD(s, -10, '2013-07-14 23:00:00') AND '2013-07-14 23:00:00' GROUP BY RegionID, OS, UserAgent, TraficSourceID;
15+
-- T007: quantile window ending at 2013-07-14 23:30:00
16+
SELECT QUANTILE(0.95, ResolutionWidth) FROM hits WHERE EventTime BETWEEN DATEADD(s, -10, '2013-07-14 23:30:00') AND '2013-07-14 23:30:00' GROUP BY RegionID, OS, UserAgent, TraficSourceID;
17+
-- T008: quantile window ending at 2013-07-15 00:00:00
18+
SELECT QUANTILE(0.95, ResolutionWidth) FROM hits WHERE EventTime BETWEEN DATEADD(s, -10, '2013-07-15 00:00:00') AND '2013-07-15 00:00:00' GROUP BY RegionID, OS, UserAgent, TraficSourceID;
19+
-- T009: quantile window ending at 2013-07-15 00:30:00
20+
SELECT QUANTILE(0.95, ResolutionWidth) FROM hits WHERE EventTime BETWEEN DATEADD(s, -10, '2013-07-15 00:30:00') AND '2013-07-15 00:30:00' GROUP BY RegionID, OS, UserAgent, TraficSourceID;
21+
-- T010: quantile window ending at 2013-07-15 01:00:00
22+
SELECT QUANTILE(0.95, ResolutionWidth) FROM hits WHERE EventTime BETWEEN DATEADD(s, -10, '2013-07-15 01:00:00') AND '2013-07-15 01:00:00' GROUP BY RegionID, OS, UserAgent, TraficSourceID;
23+
-- T011: quantile window ending at 2013-07-15 01:30:00
24+
SELECT QUANTILE(0.95, ResolutionWidth) FROM hits WHERE EventTime BETWEEN DATEADD(s, -10, '2013-07-15 01:30:00') AND '2013-07-15 01:30:00' GROUP BY RegionID, OS, UserAgent, TraficSourceID;
25+
-- T012: quantile window ending at 2013-07-15 02:00:00
26+
SELECT QUANTILE(0.95, ResolutionWidth) FROM hits WHERE EventTime BETWEEN DATEADD(s, -10, '2013-07-15 02:00:00') AND '2013-07-15 02:00:00' GROUP BY RegionID, OS, UserAgent, TraficSourceID;
27+
-- T013: quantile window ending at 2013-07-15 02:30:00
28+
SELECT QUANTILE(0.95, ResolutionWidth) FROM hits WHERE EventTime BETWEEN DATEADD(s, -10, '2013-07-15 02:30:00') AND '2013-07-15 02:30:00' GROUP BY RegionID, OS, UserAgent, TraficSourceID;
29+
-- T014: quantile window ending at 2013-07-15 03:00:00
30+
SELECT QUANTILE(0.95, ResolutionWidth) FROM hits WHERE EventTime BETWEEN DATEADD(s, -10, '2013-07-15 03:00:00') AND '2013-07-15 03:00:00' GROUP BY RegionID, OS, UserAgent, TraficSourceID;
31+
-- T015: quantile window ending at 2013-07-15 03:30:00
32+
SELECT QUANTILE(0.95, ResolutionWidth) FROM hits WHERE EventTime BETWEEN DATEADD(s, -10, '2013-07-15 03:30:00') AND '2013-07-15 03:30:00' GROUP BY RegionID, OS, UserAgent, TraficSourceID;
33+
-- T016: quantile window ending at 2013-07-15 04:00:00
34+
SELECT QUANTILE(0.95, ResolutionWidth) FROM hits WHERE EventTime BETWEEN DATEADD(s, -10, '2013-07-15 04:00:00') AND '2013-07-15 04:00:00' GROUP BY RegionID, OS, UserAgent, TraficSourceID;
35+
-- T017: quantile window ending at 2013-07-15 04:30:00
36+
SELECT QUANTILE(0.95, ResolutionWidth) FROM hits WHERE EventTime BETWEEN DATEADD(s, -10, '2013-07-15 04:30:00') AND '2013-07-15 04:30:00' GROUP BY RegionID, OS, UserAgent, TraficSourceID;
37+
-- T018: quantile window ending at 2013-07-15 05:00:00
38+
SELECT QUANTILE(0.95, ResolutionWidth) FROM hits WHERE EventTime BETWEEN DATEADD(s, -10, '2013-07-15 05:00:00') AND '2013-07-15 05:00:00' GROUP BY RegionID, OS, UserAgent, TraficSourceID;
39+
-- T019: quantile window ending at 2013-07-15 05:30:00
40+
SELECT QUANTILE(0.95, ResolutionWidth) FROM hits WHERE EventTime BETWEEN DATEADD(s, -10, '2013-07-15 05:30:00') AND '2013-07-15 05:30:00' GROUP BY RegionID, OS, UserAgent, TraficSourceID;
41+
-- T020: quantile window ending at 2013-07-15 06:00:00
42+
SELECT QUANTILE(0.95, ResolutionWidth) FROM hits WHERE EventTime BETWEEN DATEADD(s, -10, '2013-07-15 06:00:00') AND '2013-07-15 06:00:00' GROUP BY RegionID, OS, UserAgent, TraficSourceID;
43+
-- T021: quantile window ending at 2013-07-15 06:30:00
44+
SELECT QUANTILE(0.95, ResolutionWidth) FROM hits WHERE EventTime BETWEEN DATEADD(s, -10, '2013-07-15 06:30:00') AND '2013-07-15 06:30:00' GROUP BY RegionID, OS, UserAgent, TraficSourceID;
45+
-- T022: quantile window ending at 2013-07-15 07:00:00
46+
SELECT QUANTILE(0.95, ResolutionWidth) FROM hits WHERE EventTime BETWEEN DATEADD(s, -10, '2013-07-15 07:00:00') AND '2013-07-15 07:00:00' GROUP BY RegionID, OS, UserAgent, TraficSourceID;
47+
-- T023: quantile window ending at 2013-07-15 07:30:00
48+
SELECT QUANTILE(0.95, ResolutionWidth) FROM hits WHERE EventTime BETWEEN DATEADD(s, -10, '2013-07-15 07:30:00') AND '2013-07-15 07:30:00' GROUP BY RegionID, OS, UserAgent, TraficSourceID;
49+
-- T024: quantile window ending at 2013-07-15 08:00:00
50+
SELECT QUANTILE(0.95, ResolutionWidth) FROM hits WHERE EventTime BETWEEN DATEADD(s, -10, '2013-07-15 08:00:00') AND '2013-07-15 08:00:00' GROUP BY RegionID, OS, UserAgent, TraficSourceID;
51+
-- T025: quantile window ending at 2013-07-15 08:30:00
52+
SELECT QUANTILE(0.95, ResolutionWidth) FROM hits WHERE EventTime BETWEEN DATEADD(s, -10, '2013-07-15 08:30:00') AND '2013-07-15 08:30:00' GROUP BY RegionID, OS, UserAgent, TraficSourceID;
53+
-- T026: quantile window ending at 2013-07-15 09:00:00
54+
SELECT QUANTILE(0.95, ResolutionWidth) FROM hits WHERE EventTime BETWEEN DATEADD(s, -10, '2013-07-15 09:00:00') AND '2013-07-15 09:00:00' GROUP BY RegionID, OS, UserAgent, TraficSourceID;
55+
-- T027: quantile window ending at 2013-07-15 09:30:00
56+
SELECT QUANTILE(0.95, ResolutionWidth) FROM hits WHERE EventTime BETWEEN DATEADD(s, -10, '2013-07-15 09:30:00') AND '2013-07-15 09:30:00' GROUP BY RegionID, OS, UserAgent, TraficSourceID;
57+
-- T028: quantile window ending at 2013-07-15 10:00:00
58+
SELECT QUANTILE(0.95, ResolutionWidth) FROM hits WHERE EventTime BETWEEN DATEADD(s, -10, '2013-07-15 10:00:00') AND '2013-07-15 10:00:00' GROUP BY RegionID, OS, UserAgent, TraficSourceID;
59+
-- T029: quantile window ending at 2013-07-15 10:30:00
60+
SELECT QUANTILE(0.95, ResolutionWidth) FROM hits WHERE EventTime BETWEEN DATEADD(s, -10, '2013-07-15 10:30:00') AND '2013-07-15 10:30:00' GROUP BY RegionID, OS, UserAgent, TraficSourceID;
61+
-- T030: quantile window ending at 2013-07-15 11:00:00
62+
SELECT QUANTILE(0.95, ResolutionWidth) FROM hits WHERE EventTime BETWEEN DATEADD(s, -10, '2013-07-15 11:00:00') AND '2013-07-15 11:00:00' GROUP BY RegionID, OS, UserAgent, TraficSourceID;
63+
-- T031: quantile window ending at 2013-07-15 11:30:00
64+
SELECT QUANTILE(0.95, ResolutionWidth) FROM hits WHERE EventTime BETWEEN DATEADD(s, -10, '2013-07-15 11:30:00') AND '2013-07-15 11:30:00' GROUP BY RegionID, OS, UserAgent, TraficSourceID;
65+
-- T032: quantile window ending at 2013-07-15 12:00:00
66+
SELECT QUANTILE(0.95, ResolutionWidth) FROM hits WHERE EventTime BETWEEN DATEADD(s, -10, '2013-07-15 12:00:00') AND '2013-07-15 12:00:00' GROUP BY RegionID, OS, UserAgent, TraficSourceID;
67+
-- T033: quantile window ending at 2013-07-15 12:30:00
68+
SELECT QUANTILE(0.95, ResolutionWidth) FROM hits WHERE EventTime BETWEEN DATEADD(s, -10, '2013-07-15 12:30:00') AND '2013-07-15 12:30:00' GROUP BY RegionID, OS, UserAgent, TraficSourceID;
69+
-- T034: quantile window ending at 2013-07-15 13:00:00
70+
SELECT QUANTILE(0.95, ResolutionWidth) FROM hits WHERE EventTime BETWEEN DATEADD(s, -10, '2013-07-15 13:00:00') AND '2013-07-15 13:00:00' GROUP BY RegionID, OS, UserAgent, TraficSourceID;
71+
-- T035: quantile window ending at 2013-07-15 13:30:00
72+
SELECT QUANTILE(0.95, ResolutionWidth) FROM hits WHERE EventTime BETWEEN DATEADD(s, -10, '2013-07-15 13:30:00') AND '2013-07-15 13:30:00' GROUP BY RegionID, OS, UserAgent, TraficSourceID;
73+
-- T036: quantile window ending at 2013-07-15 14:00:00
74+
SELECT QUANTILE(0.95, ResolutionWidth) FROM hits WHERE EventTime BETWEEN DATEADD(s, -10, '2013-07-15 14:00:00') AND '2013-07-15 14:00:00' GROUP BY RegionID, OS, UserAgent, TraficSourceID;
75+
-- T037: quantile window ending at 2013-07-15 14:30:00
76+
SELECT QUANTILE(0.95, ResolutionWidth) FROM hits WHERE EventTime BETWEEN DATEADD(s, -10, '2013-07-15 14:30:00') AND '2013-07-15 14:30:00' GROUP BY RegionID, OS, UserAgent, TraficSourceID;
77+
-- T038: quantile window ending at 2013-07-15 15:00:00
78+
SELECT QUANTILE(0.95, ResolutionWidth) FROM hits WHERE EventTime BETWEEN DATEADD(s, -10, '2013-07-15 15:00:00') AND '2013-07-15 15:00:00' GROUP BY RegionID, OS, UserAgent, TraficSourceID;
79+
-- T039: quantile window ending at 2013-07-15 15:30:00
80+
SELECT QUANTILE(0.95, ResolutionWidth) FROM hits WHERE EventTime BETWEEN DATEADD(s, -10, '2013-07-15 15:30:00') AND '2013-07-15 15:30:00' GROUP BY RegionID, OS, UserAgent, TraficSourceID;
81+
-- T040: quantile window ending at 2013-07-15 16:00:00
82+
SELECT QUANTILE(0.95, ResolutionWidth) FROM hits WHERE EventTime BETWEEN DATEADD(s, -10, '2013-07-15 16:00:00') AND '2013-07-15 16:00:00' GROUP BY RegionID, OS, UserAgent, TraficSourceID;
83+
-- T041: quantile window ending at 2013-07-15 16:30:00
84+
SELECT QUANTILE(0.95, ResolutionWidth) FROM hits WHERE EventTime BETWEEN DATEADD(s, -10, '2013-07-15 16:30:00') AND '2013-07-15 16:30:00' GROUP BY RegionID, OS, UserAgent, TraficSourceID;
85+
-- T042: quantile window ending at 2013-07-15 17:00:00
86+
SELECT QUANTILE(0.95, ResolutionWidth) FROM hits WHERE EventTime BETWEEN DATEADD(s, -10, '2013-07-15 17:00:00') AND '2013-07-15 17:00:00' GROUP BY RegionID, OS, UserAgent, TraficSourceID;
87+
-- T043: quantile window ending at 2013-07-15 17:30:00
88+
SELECT QUANTILE(0.95, ResolutionWidth) FROM hits WHERE EventTime BETWEEN DATEADD(s, -10, '2013-07-15 17:30:00') AND '2013-07-15 17:30:00' GROUP BY RegionID, OS, UserAgent, TraficSourceID;
89+
-- T044: quantile window ending at 2013-07-15 18:00:00
90+
SELECT QUANTILE(0.95, ResolutionWidth) FROM hits WHERE EventTime BETWEEN DATEADD(s, -10, '2013-07-15 18:00:00') AND '2013-07-15 18:00:00' GROUP BY RegionID, OS, UserAgent, TraficSourceID;
91+
-- T045: quantile window ending at 2013-07-15 18:30:00
92+
SELECT QUANTILE(0.95, ResolutionWidth) FROM hits WHERE EventTime BETWEEN DATEADD(s, -10, '2013-07-15 18:30:00') AND '2013-07-15 18:30:00' GROUP BY RegionID, OS, UserAgent, TraficSourceID;
93+
-- T046: quantile window ending at 2013-07-15 19:00:00
94+
SELECT QUANTILE(0.95, ResolutionWidth) FROM hits WHERE EventTime BETWEEN DATEADD(s, -10, '2013-07-15 19:00:00') AND '2013-07-15 19:00:00' GROUP BY RegionID, OS, UserAgent, TraficSourceID;
95+
-- T047: quantile window ending at 2013-07-15 19:30:00
96+
SELECT QUANTILE(0.95, ResolutionWidth) FROM hits WHERE EventTime BETWEEN DATEADD(s, -10, '2013-07-15 19:30:00') AND '2013-07-15 19:30:00' GROUP BY RegionID, OS, UserAgent, TraficSourceID;
97+
-- T048: quantile window ending at 2013-07-15 20:00:00
98+
SELECT QUANTILE(0.95, ResolutionWidth) FROM hits WHERE EventTime BETWEEN DATEADD(s, -10, '2013-07-15 20:00:00') AND '2013-07-15 20:00:00' GROUP BY RegionID, OS, UserAgent, TraficSourceID;
99+
-- T049: quantile window ending at 2013-07-15 20:30:00
100+
SELECT QUANTILE(0.95, ResolutionWidth) FROM hits WHERE EventTime BETWEEN DATEADD(s, -10, '2013-07-15 20:30:00') AND '2013-07-15 20:30:00' GROUP BY RegionID, OS, UserAgent, TraficSourceID;

0 commit comments

Comments
 (0)