CREATE STREAM
Create a new hstream stream with the given name. An exception will be thrown if a stream with the same name already exists.
Synopsis
sql
CREATE STREAM stream_name [ AS select_query ] WITH ([ REPLICATE = INT, DURATION = INTERVAL ]);Notes
stream_nameis a valid identifier.select_queryis an optionalSELECT(Stream) query. For more information, seeSELECTsection. When<select_query>is specified, the created stream will be filled with records from theSELECTquery continuously. Otherwise, the stream will only be created and kept empty.WITHclause contains some stream options. OnlyREPLICATEandDURATIONoptions are supported now, which represents the replication factor and the retention time of the stream. If it is not specified, they will be set to default value.- Sources in
select_querycan be both stream(s) and materialized view(s).
Examples
sql
CREATE STREAM foo;
CREATE STREAM abnormal_weather AS SELECT * FROM weather WHERE temperature > 30 AND humidity > 80;