It is not a typecheck error to leave a schema empty, with no fields defined. For example, when you drag an Input Stream to the canvas, it works immediately (before you configure its schema), without throwing a typecheck error.
There are two primary advantages of supporting empty schemas:
-
You are not required to stop and configure a new stream the moment it is dropped, but can proceed with designing your module at your own pace. A module with empty schema streams does pass typechecking, and can be run and debugged during early stages of development. You can return to such streams later to add a schema.
-
A tuple with an empty schema can be used as a signal that an event occurred on a stream where the content of the event is unimportant, and only the fact that the event occurred is considered.
For example, an input stream whose purpose is to trigger a Read All Rows operation on a Query Table does not logically need any fields. Before empty schemas were available, a dummy field was required in triggering input streams to satisfy the syntactic demands of the language. The dummy field was often a boolean or an int field whose value was not used at all in downstream processing. Such dummy fields are no longer required.
Empty schemas are supported throughout StreamBase Studio, including in the EventFlow
Debugger, trace files, and Properties views. A stream with an empty schema shows with
<no fields>
in the Manual Input view, but you can
still click the button to send a tuple with no
fields. The Input Streams and Output Streams views show such a tuple with <no fields>
as their content.
Feed simulations accept an empty schema for a specified input stream. The defined simulation for such streams is limited to the Default Generation Method, in which case, the feed simulation, when run, sends a specified number of tuples with no fields to the specified stream. You cannot specify a Data File input method for a stream with an empty schema.
At the command prompt, you can use sbc enqueue or jsbc enqueue to send a no-fields tuple to an input stream with an empty schema: send a single line consisting of one or more spaces or tabs. You can also use jsbc enqueue --json to send one or more spaces or tabs delimited by braces.
There is no defined way to represent an empty schema in the CSV standard, but sending a line that contains only a space does work for StreamBase input streams defined with empty schemas.
Empty schemas are not supported in the following situations:
-
Certain adapters, including the CSV File Reader and CSV Socket Reader adapters, do not support empty schemas.
-
Empty schemas cannot be specified in places where you declare an explicit output schema, including Output Streams and the Union operator.