CREATE [PUBLIC] INPUT STREAMstream_identifiernamed_schema_identifier|anonymous_schema;
-
stream_identifier -
A unique identifier (name) for the input stream.
-
named_schema_identifier -
The identifier of a previously-defined named schema. Imports all of the named schema's fields. No parentheses are required, and no other fields are permitted.
-
anonymous_schema -
A schema definition, delimited by parentheses, in the following format:
(
field_definition[, ...])-
field_definition -
A field definition takes the form:
field_identifierfield_type-
field_identifier -
A unique name for a field in the schema associated with the stream. For table indexes, if the field references a named schema, the entire schema is used as the key.
-
field_type -
One of the supported StreamBase data types.
-
-
The following statements create a named schema and reference it in an input stream:
CREATE SCHEMA SymbolSchema (ID int, Symbol string, Price double); CREATE INPUT STREAM Input1 SymbolSchema;
The input stream statement above is equivalent to the following, using an anonymous schema:
CREATE INPUT STREAM Input1 (ID int, Symbol string, Price double);
The next two input statements use anonymous schemas:
CREATE INPUT STREAM Input2 (ID int, Symbol string, Price double); CREATE INPUT STREAM Input3 (ss SymbolSchema, Quantity int);
The second anonymous schema combines a reference to the named schema shown earlier with another field. It is equivalent to:
ss (ID int, Symbol string, Price double), Quantity int
The CREATE INPUT STREAM statement defines an Input Stream. The types and order of fields contained in the incoming tuples must either be defined in an anonymous schema, or referenced from a previously defined named schema.
To use a named schema, simply provide its name. To use an anonymous schema, declare a comma-separated list of fields, specifying the identifier and data type of each, and enclose the schema in parentheses.
You must define a schema. For example, the statement CREATE INPUT STREAM () will result in a runtime error.
Use the optional PUBLIC keyword to designate that this stream is to be available for enqueuing, no matter how deeply the module that contains this stream is nested in a complex application.
