Skip to content

Stream Statements ​

SQL Data Definition Language (DDL) statements create and manage data streams.

CREATE STREAM ​

The CREATE STREAM statement registers a new stream connected to an external source:

sql
CREATE STREAM stream_name
    ( column_name <data_type> [ DEFAULT <constant_value> ] [ ,...n ] )
    WITH ( property_name = expression [, ...] );

For detailed property definitions and stream options, refer to the Stream Overview Guide.

Default Column Values ​

Define default values for columns in stream schemas. If an incoming event omits the field or contains null, rekuiper assigns the declared default value:

sql
CREATE STREAM sensor_stream (
    device_id string,
    temperature float DEFAULT 25.0,
    status string DEFAULT "normal"
) WITH (
    DATASOURCE = "sensor/telemetry",
    FORMAT = "json"
);

Example ​

sql
CREATE STREAM my_stream ()
WITH (
    DATASOURCE = "topic/temperature",
    FORMAT = "json",
    KEY = "id",
    BUFFER_FULL_POLICY = "block"
);

Buffer Policy ​

Use the BUFFER_FULL_POLICY property to control ingestion when the input buffer is full.

  • block: The source pauses reading until the buffer has available space.
  • dropOldest: The source deletes the oldest record to accept the incoming record. Default if omitted.

The server rejects other values with an error during stream creation and update.

Multi-Stream Rules (Joins) ​

When a rule query joins multiple streams (e.g. FROM stream1 JOIN stream2 ON ...), all streams referenced in the query must configure an identical BUFFER_FULL_POLICY. If one stream uses block while another uses dropOldest, the server rejects the rule with a validation error to prevent asymmetric backpressure deadlocks and erratic tuple drops.

DESCRIBE STREAM ​

The DESCRIBE STREAM statement returns the schema and configuration of a registered stream:

sql
DESCRIBE STREAM stream_name;

DROP STREAM ​

The DROP STREAM statement removes a registered stream definition:

sql
DROP STREAM stream_name;

CAUTION

Delete all rules that reference the stream before running DROP STREAM.

SHOW STREAMS ​

The SHOW STREAMS statement lists all streams currently registered in the database:

sql
SHOW STREAMS;

rekuiper is open source (Apache-2.0 / MIT) · For an all-in-one MQTT broker with embedded rekuiper rules, see IndraMQTT.