/ crates / arroyo-sql-testing / src / test / queries / aggregates.sql
aggregates.sql
 1  CREATE TABLE impulse_source (
 2        timestamp TIMESTAMP,
 3        counter bigint unsigned not null,
 4        subtask_index bigint unsigned not null
 5      ) WITH (
 6        connector = 'single_file',
 7        path = '$input_dir/impulse.json',
 8        format = 'json',
 9        type = 'source'
10      );
11      CREATE TABLE aggregates (
12        min BIGINT,
13        max BIGINT,
14        sum BIGINT,
15        count BIGINT,
16        avg DOUBLE
17      ) WITH (
18        connector = 'single_file',
19        path = '$output_path',
20        format = 'debezium_json',
21        type = 'sink'
22      );
23  
24  INSERT INTO aggregates SELECT min(counter), max(counter), sum(counter), count(*), avg(counter)  FROM impulse_source