Contents
The Runtime Schema Cast operator casts its input schema to its configured target output schema at run time. This operator is used in nested modules to expand the subfields within a capture field, either by flattening or nesting the captured subfields. Flattened subfields appear as top-level fields of the target schema, while nested fields appear as subfields of a top-level tuple field whose name matches that of the captured field.
See Using the Runtime Schema Cast Operator for more on possible uses for this operator.
In StreamBase Studio, import this sample with the following steps:
-
From the top-level menu, select
> . -
Enter
cast
in the search field to narrow the list of options. -
Select Runtime Schema Cast Operator from the Data Constructs and Operators category,
-
Click
.
StreamBase Studio creates a single project containing the sample files.
-
In the Project Explorer view, open this sample's folder.
Keep an eye on the bottom right status bar of the Studio window. Make sure any
Updating
,Downloading
,Building
, orRebuild project
messages finish before you proceed. -
Open the
src/main/eventflow/
folder.packageName
-
Double-click to open the
runtime-cast-example-outer.sbapp
module. Make sure the module is the currently active tab in the EventFlow Editor. -
Click the Run
-
Wait for the Waiting for fragment to initialize message to clear.
-
In the Manual Input view, click
to send the defaultnull
-
In the Console view, observe the tuples before and after being flattened by the
FlattenCaptureFields
operator and again after being un-flattened by theUnflattenCaptureFields
:-
In the tuple logged by the
LogBeforeFlatten
operator, the captured fields are displayed as subfields of theInstrumentFields
top-level field. -
In the tuple logged by the
LogAfterFlatten
operator, the captured fields are displayed as top-level fields. -
Finally, in the tuple logged by the
LogAfterUnflatten
operator, the captured fields are displayed once again as subfields of theInstrumentFields
top-level field.
-
-
Press F9 or click the Terminate EventFlow Fragment button.
When you load the sample into StreamBase® Studio, Studio copies the sample project's files to your Studio workspace, which is normally part of your home directory, with full access rights.
Important
Load this sample in StreamBase® Studio, and thereafter use the Studio workspace copy of the sample to run and test it, even when running from the command prompt.
Using the workspace copy of the sample avoids permission problems. The default workspace location for this sample is:
studio-workspace
/sample_runtime-cast-operator
See Default Installation
Directories for the default location of studio-workspace
on your system.