Skip to content

Instantly share code, notes, and snippets.

@kgorman
Last active February 12, 2016 20:30
Show Gist options
  • Save kgorman/a6445486b8d861fabcef to your computer and use it in GitHub Desktop.
Save kgorman/a6445486b8d861fabcef to your computer and use it in GitHub Desktop.
-- here is my stream
drop stream test_stream cascade;
create stream test_stream (speed int, ts int, tail char(10));
create continuous view v1 as select ts, tail, speed from test_stream;
create continuous view v2 as select tail, keyed_max(ts, speed) from test_stream group by tail;
-- put some data into it
insert into test_stream values (100, 1, 'YY');
insert into test_stream values (500, 1, 'ZZ');
insert into test_stream values (110, 2, 'YY');
select * from v1;
select * from v2;
insert into test_stream values (600, 3, 'YY');
select * from v2;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment