Contents
This topic describes how to run the Spotfire Streaming for Apache Kudu operator sample application, which illustrates how to use the operators with a Kudu database cluster.
For more information on this operator, see Using the Apache Kudu Operators.
This sample includes a number of Kudu operators, which by default connect to a Kudu
cluster named Test Cluster
, which is assumed to already
be running on localhost. In addition, you should see a table called myTable
created on the Kudu cluster with the following fields:
-
id (key) as INT32
-
firstName as STRING
-
lastName as STRING
-
accountNumber as INT64
-
balance as DOUBLE
Once connected, use the sample to read and write to the table using the various operators.
In StreamBase Studio, import this sample with the following steps:
-
From the top-level menu, select
> . -
Enter
kudu
to narrow the list of options. -
Select Apache Kudu Operators from the Large Data Storage and Analysis category.
-
Click
.
StreamBase Studio creates a single project for the Kudu Operator samples in your current Studio workspace.
The steps to run this sample in Studio are as follows:
-
In the Project Explorer view, open the sample you just loaded.
If you see red marks on a project folder, wait a moment for the project to load its features.
If the red marks do not resolve themselves after a minute, select the project, right-click, and select Maven> from the context menu.
-
Open the
src/main/eventflow/
folder.packageName
-
Open the
kudu.sbapp
file and click the Run button. This opens the SB Test/Debug perspective and starts the module. -
In the Manual Input view, select the
DoInsert
input stream. -
Enter the following values:
-
row.id
:1
-
row.firstName
:Jim
-
row.lastName
:Morrison
-
row.accountNumber
:11
-
row.balance
:1111.11
Click
to add the row to the table, and observe that theInsertResults
output stream received a tuple indicating that the operation has succeeded. -
-
In the Manual Input view, select the
DoRowScan
input stream. -
Enter the following values:
-
predicates.lastName.eq
:Morrison
Click
to send the query, and observe that theScannerResults
output stream received a tuple with the results from the query ― specifically, the row that was added to the table earlier. One more tuple is then emitted, with itsrow
field set tonull
, to indicate the end of the query. -
-
You may similarly Delete rows and issue UPDATE and UPSERT queries using the DoDelete, DoUpdate and DoUpsert input streams, respectively.
-
When done, press F9 or click the Terminate EventFlow Fragment button.
This sample contains the following files:
-
The sample EventFlow application,
kudu.sbapp
. -
A corresponding adapter configuration file,
Kudu.conf
, which the StreamBase Server uses to configure the connection to the Kudu cluster.
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_kudu
See Default Installation
Directories for the default location of studio-workspace
on your system.