CREATE TABLE host ( ts timestamp(3) time index, host STRING PRIMARY KEY, val BIGINT, ); Affected Rows: 0 INSERT INTO TABLE host VALUES (0, 'host1', 0), (5000, 'host1', null), (10000, 'host1', 1), (15000, 'host1', null), (20000, 'host1', 2), (0, 'host2', 3), (5000, 'host2', null), (10000, 'host2', 4), (15000, 'host2', null), (20000, 'host2', 5); Affected Rows: 10 -- Test Fill when aggregate result is null SELECT ts, host, min(val) RANGE '5s' FROM host ALIGN '5s' ORDER BY host, ts; +---------------------+-------+------------------------+ | ts | host | min(host.val) RANGE 5s | +---------------------+-------+------------------------+ | 1970-01-01T00:00:00 | host1 | 0 | | 1970-01-01T00:00:05 | host1 | | | 1970-01-01T00:00:10 | host1 | 1 | | 1970-01-01T00:00:15 | host1 | | | 1970-01-01T00:00:20 | host1 | 2 | | 1970-01-01T00:00:00 | host2 | 3 | | 1970-01-01T00:00:05 | host2 | | | 1970-01-01T00:00:10 | host2 | 4 | | 1970-01-01T00:00:15 | host2 | | | 1970-01-01T00:00:20 | host2 | 5 | +---------------------+-------+------------------------+ SELECT ts, host, min(val) RANGE '5s' FROM host ALIGN '5s' FILL NULL ORDER BY host, ts; +---------------------+-------+----------------------------------+ | ts | host | min(host.val) RANGE 5s FILL NULL | +---------------------+-------+----------------------------------+ | 1970-01-01T00:00:00 | host1 | 0 | | 1970-01-01T00:00:05 | host1 | | | 1970-01-01T00:00:10 | host1 | 1 | | 1970-01-01T00:00:15 | host1 | | | 1970-01-01T00:00:20 | host1 | 2 | | 1970-01-01T00:00:00 | host2 | 3 | | 1970-01-01T00:00:05 | host2 | | | 1970-01-01T00:00:10 | host2 | 4 | | 1970-01-01T00:00:15 | host2 | | | 1970-01-01T00:00:20 | host2 | 5 | +---------------------+-------+----------------------------------+ SELECT ts, host, min(val) RANGE '5s', min(val) RANGE '5s' FILL 6 FROM host ALIGN '5s' ORDER BY host, ts; +---------------------+-------+------------------------+-------------------------------+ | ts | host | min(host.val) RANGE 5s | min(host.val) RANGE 5s FILL 6 | +---------------------+-------+------------------------+-------------------------------+ | 1970-01-01T00:00:00 | host1 | 0 | 0 | | 1970-01-01T00:00:05 | host1 | | 6 | | 1970-01-01T00:00:10 | host1 | 1 | 1 | | 1970-01-01T00:00:15 | host1 | | 6 | | 1970-01-01T00:00:20 | host1 | 2 | 2 | | 1970-01-01T00:00:00 | host2 | 3 | 3 | | 1970-01-01T00:00:05 | host2 | | 6 | | 1970-01-01T00:00:10 | host2 | 4 | 4 | | 1970-01-01T00:00:15 | host2 | | 6 | | 1970-01-01T00:00:20 | host2 | 5 | 5 | +---------------------+-------+------------------------+-------------------------------+ SELECT ts, host, min(val) RANGE '5s', min(val) RANGE '5s' FILL PREV FROM host ALIGN '5s'ORDER BY host, ts; +---------------------+-------+------------------------+----------------------------------+ | ts | host | min(host.val) RANGE 5s | min(host.val) RANGE 5s FILL PREV | +---------------------+-------+------------------------+----------------------------------+ | 1970-01-01T00:00:00 | host1 | 0 | 0 | | 1970-01-01T00:00:05 | host1 | | 0 | | 1970-01-01T00:00:10 | host1 | 1 | 1 | | 1970-01-01T00:00:15 | host1 | | 1 | | 1970-01-01T00:00:20 | host1 | 2 | 2 | | 1970-01-01T00:00:00 | host2 | 3 | 3 | | 1970-01-01T00:00:05 | host2 | | 3 | | 1970-01-01T00:00:10 | host2 | 4 | 4 | | 1970-01-01T00:00:15 | host2 | | 4 | | 1970-01-01T00:00:20 | host2 | 5 | 5 | +---------------------+-------+------------------------+----------------------------------+ SELECT ts, host, min(val) RANGE '5s', min(val) RANGE '5s' FILL LINEAR FROM host ALIGN '5s' ORDER BY host, ts; +---------------------+-------+------------------------+------------------------------------+ | ts | host | min(host.val) RANGE 5s | min(host.val) RANGE 5s FILL LINEAR | +---------------------+-------+------------------------+------------------------------------+ | 1970-01-01T00:00:00 | host1 | 0 | 0.0 | | 1970-01-01T00:00:05 | host1 | | 0.5 | | 1970-01-01T00:00:10 | host1 | 1 | 1.0 | | 1970-01-01T00:00:15 | host1 | | 1.5 | | 1970-01-01T00:00:20 | host1 | 2 | 2.0 | | 1970-01-01T00:00:00 | host2 | 3 | 3.0 | | 1970-01-01T00:00:05 | host2 | | 3.5 | | 1970-01-01T00:00:10 | host2 | 4 | 4.0 | | 1970-01-01T00:00:15 | host2 | | 4.5 | | 1970-01-01T00:00:20 | host2 | 5 | 5.0 | +---------------------+-------+------------------------+------------------------------------+ DROP TABLE host; Affected Rows: 0 -- Test Fill when time slot data is missing CREATE TABLE host ( ts timestamp(3) time index, host STRING PRIMARY KEY, val BIGINT, ); Affected Rows: 0 INSERT INTO TABLE host VALUES (0, 'host1', 0), (1000, 'host1', 1), (2000, 'host1', 2), -- missing data for 5000, 10000 (15000, 'host1', 6), (16000, 'host1', 7), (17000, 'host1', 8), (0, 'host2', 6), (1000, 'host2', 7), (2000, 'host2', 8), -- missing data for 5000, 10000 (15000, 'host2', 12), (16000, 'host2', 13), (17000, 'host2', 14); Affected Rows: 12 SELECT ts, host, min(val) RANGE '5s' FROM host ALIGN '5s' ORDER BY host, ts; +---------------------+-------+------------------------+ | ts | host | min(host.val) RANGE 5s | +---------------------+-------+------------------------+ | 1970-01-01T00:00:00 | host1 | 0 | | 1970-01-01T00:00:15 | host1 | 6 | | 1970-01-01T00:00:00 | host2 | 6 | | 1970-01-01T00:00:15 | host2 | 12 | +---------------------+-------+------------------------+ SELECT ts, host, min(val) RANGE '5s' FILL NULL FROM host ALIGN '5s' ORDER BY host, ts; +---------------------+-------+----------------------------------+ | ts | host | min(host.val) RANGE 5s FILL NULL | +---------------------+-------+----------------------------------+ | 1970-01-01T00:00:00 | host1 | 0 | | 1970-01-01T00:00:05 | host1 | | | 1970-01-01T00:00:10 | host1 | | | 1970-01-01T00:00:15 | host1 | 6 | | 1970-01-01T00:00:00 | host2 | 6 | | 1970-01-01T00:00:05 | host2 | | | 1970-01-01T00:00:10 | host2 | | | 1970-01-01T00:00:15 | host2 | 12 | +---------------------+-------+----------------------------------+ SELECT ts, host, min(val) RANGE '5s' FILL PREV FROM host ALIGN '5s' ORDER BY host, ts; +---------------------+-------+----------------------------------+ | ts | host | min(host.val) RANGE 5s FILL PREV | +---------------------+-------+----------------------------------+ | 1970-01-01T00:00:00 | host1 | 0 | | 1970-01-01T00:00:05 | host1 | 0 | | 1970-01-01T00:00:10 | host1 | 0 | | 1970-01-01T00:00:15 | host1 | 6 | | 1970-01-01T00:00:00 | host2 | 6 | | 1970-01-01T00:00:05 | host2 | 6 | | 1970-01-01T00:00:10 | host2 | 6 | | 1970-01-01T00:00:15 | host2 | 12 | +---------------------+-------+----------------------------------+ SELECT ts, host, min(val) RANGE '5s' FILL LINEAR FROM host ALIGN '5s' ORDER BY host, ts; +---------------------+-------+------------------------------------+ | ts | host | min(host.val) RANGE 5s FILL LINEAR | +---------------------+-------+------------------------------------+ | 1970-01-01T00:00:00 | host1 | 0.0 | | 1970-01-01T00:00:05 | host1 | 2.0 | | 1970-01-01T00:00:10 | host1 | 4.0 | | 1970-01-01T00:00:15 | host1 | 6.0 | | 1970-01-01T00:00:00 | host2 | 6.0 | | 1970-01-01T00:00:05 | host2 | 8.0 | | 1970-01-01T00:00:10 | host2 | 10.0 | | 1970-01-01T00:00:15 | host2 | 12.0 | +---------------------+-------+------------------------------------+ SELECT ts, host, min(val) RANGE '5s' FILL 6 FROM host ALIGN '5s' ORDER BY host, ts; +---------------------+-------+-------------------------------+ | ts | host | min(host.val) RANGE 5s FILL 6 | +---------------------+-------+-------------------------------+ | 1970-01-01T00:00:00 | host1 | 0 | | 1970-01-01T00:00:05 | host1 | 6 | | 1970-01-01T00:00:10 | host1 | 6 | | 1970-01-01T00:00:15 | host1 | 6 | | 1970-01-01T00:00:00 | host2 | 6 | | 1970-01-01T00:00:05 | host2 | 6 | | 1970-01-01T00:00:10 | host2 | 6 | | 1970-01-01T00:00:15 | host2 | 12 | +---------------------+-------+-------------------------------+ SELECT ts, host, min(val) RANGE '5s' FROM host ALIGN '5s' FILL NULL ORDER BY host, ts; +---------------------+-------+----------------------------------+ | ts | host | min(host.val) RANGE 5s FILL NULL | +---------------------+-------+----------------------------------+ | 1970-01-01T00:00:00 | host1 | 0 | | 1970-01-01T00:00:05 | host1 | | | 1970-01-01T00:00:10 | host1 | | | 1970-01-01T00:00:15 | host1 | 6 | | 1970-01-01T00:00:00 | host2 | 6 | | 1970-01-01T00:00:05 | host2 | | | 1970-01-01T00:00:10 | host2 | | | 1970-01-01T00:00:15 | host2 | 12 | +---------------------+-------+----------------------------------+ SELECT ts, host, min(val) RANGE '5s', min(val) RANGE '5s' FILL NULL FROM host ALIGN '5s' ORDER BY host, ts; +---------------------+-------+------------------------+----------------------------------+ | ts | host | min(host.val) RANGE 5s | min(host.val) RANGE 5s FILL NULL | +---------------------+-------+------------------------+----------------------------------+ | 1970-01-01T00:00:00 | host1 | 0 | 0 | | 1970-01-01T00:00:05 | host1 | | | | 1970-01-01T00:00:10 | host1 | | | | 1970-01-01T00:00:15 | host1 | 6 | 6 | | 1970-01-01T00:00:00 | host2 | 6 | 6 | | 1970-01-01T00:00:05 | host2 | | | | 1970-01-01T00:00:10 | host2 | | | | 1970-01-01T00:00:15 | host2 | 12 | 12 | +---------------------+-------+------------------------+----------------------------------+ SELECT ts, host, min(val) RANGE '5s', min(val) RANGE '5s' FILL 6 FROM host ALIGN '5s' ORDER BY host, ts; +---------------------+-------+------------------------+-------------------------------+ | ts | host | min(host.val) RANGE 5s | min(host.val) RANGE 5s FILL 6 | +---------------------+-------+------------------------+-------------------------------+ | 1970-01-01T00:00:00 | host1 | 0 | 0 | | 1970-01-01T00:00:05 | host1 | | 6 | | 1970-01-01T00:00:10 | host1 | | 6 | | 1970-01-01T00:00:15 | host1 | 6 | 6 | | 1970-01-01T00:00:00 | host2 | 6 | 6 | | 1970-01-01T00:00:05 | host2 | | 6 | | 1970-01-01T00:00:10 | host2 | | 6 | | 1970-01-01T00:00:15 | host2 | 12 | 12 | +---------------------+-------+------------------------+-------------------------------+ SELECT ts, host, min(val) RANGE '5s', min(val) RANGE '5s' FILL PREV FROM host ALIGN '5s'ORDER BY host, ts; +---------------------+-------+------------------------+----------------------------------+ | ts | host | min(host.val) RANGE 5s | min(host.val) RANGE 5s FILL PREV | +---------------------+-------+------------------------+----------------------------------+ | 1970-01-01T00:00:00 | host1 | 0 | 0 | | 1970-01-01T00:00:05 | host1 | | 0 | | 1970-01-01T00:00:10 | host1 | | 0 | | 1970-01-01T00:00:15 | host1 | 6 | 6 | | 1970-01-01T00:00:00 | host2 | 6 | 6 | | 1970-01-01T00:00:05 | host2 | | 6 | | 1970-01-01T00:00:10 | host2 | | 6 | | 1970-01-01T00:00:15 | host2 | 12 | 12 | +---------------------+-------+------------------------+----------------------------------+ SELECT ts, host, min(val) RANGE '5s', min(val) RANGE '5s' FILL LINEAR FROM host ALIGN '5s' ORDER BY host, ts; +---------------------+-------+------------------------+------------------------------------+ | ts | host | min(host.val) RANGE 5s | min(host.val) RANGE 5s FILL LINEAR | +---------------------+-------+------------------------+------------------------------------+ | 1970-01-01T00:00:00 | host1 | 0 | 0.0 | | 1970-01-01T00:00:05 | host1 | | 2.0 | | 1970-01-01T00:00:10 | host1 | | 4.0 | | 1970-01-01T00:00:15 | host1 | 6 | 6.0 | | 1970-01-01T00:00:00 | host2 | 6 | 6.0 | | 1970-01-01T00:00:05 | host2 | | 8.0 | | 1970-01-01T00:00:10 | host2 | | 10.0 | | 1970-01-01T00:00:15 | host2 | 12 | 12.0 | +---------------------+-------+------------------------+------------------------------------+ DROP TABLE host; Affected Rows: 0