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 the Package Explorer, double-click to open the
runtime-cast-example-outer.sbapp
application. Make sure the application is the currently active tab in the EventFlow Editor. -
Click the Run button. This opens the SB Test/Debug perspective and starts the application.
-
In the Manual Input view, click
to send the defaultnull
tuple. -
In the Console view, observe the tuples before and after being flattened by the
FlattenCaptureFields
operator and again after being un-flattened by theUnflattenCaptureFields
operator.-
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 Stop Running Application button.
This section describes how to run this sample in UNIX terminal windows or Windows command prompt windows.
On Windows, be sure to use the StreamBase Command Prompt from the Start menu as described in the Test/Debug Guide, not the default command prompt.
-
Open two terminal windows on UNIX, or two StreamBase Command Prompts on Windows. In each window, navigate to your workspace copy of the sample, as described below.
-
In window 1, type:
sbd runtime-cast-example-outer.sbapp
-
In window 2, type:
echo null | sbc enqueue InputStream
-
Observe in window 1 three log tuples as described in the section on running this sample in StreamBase Studio above.
-
In window 2, type the following command to terminate the server and dequeuer:
sbadmin shutdown
In StreamBase Studio, import this sample with the following steps:
-
From the top menu, select
→ . -
Type
runtime
in the search field to narrow the list. -
From the Data Constructs and Operators category, select Runtime Schema Cast Operator.
-
Click OK.
StreamBase Studio creates a single project containing the sample files.
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 the permission problems that can occur when trying to work with the initially installed location of the sample. The default workspace location for this sample is:
studio-workspace
/sample_runtime-cast-operator
See Default Installation
Directories for the location of studio-workspace
on your system.
In the default TIBCO StreamBase installation, this sample's files are initially installed in:
streambase-install-dir
/sample/sample_runtime-cast-operator
See Default Installation
Directories for the location of streambase-install-dir
on your system. This location
may require administrator privileges for write access, depending on your platform.