to access transactional data stores for correlating the
incoming data with the stored data. Relational
databases provide to ways to interact with them: the
so called auto-commit mode, where each SAL
sentence executed on the database is a transaction, or
bracketing mode, where a set of sentences is
executed as a transaction. In this paper we only
address the auto-commit mode and define operators
for accessing a data store in that mode.
4.1 Database Operators
Data store operators provide the CEP with the
capability of reading and writing tuples from/to an
external data store. PaaS-CEP accesses the data
stores using operators that issue queries written in
SQL. Operators that access the data stores must be
able to retrieve data at high rates in order to correlate
stored data with the large amount of events produced
by the CEP. At the same time the data stores must be
able to store the results produced by the CEP at very
high rates. The available data store operators are
described in Table 3.
Table 3: Data store operators.
ReadSQL The ReadSQL operator requires one
input stream, S, and one output stream.
The schema of these two streams may
be different. The operator is
configured with a parameterized query
to be run against a data store. The
parameterized query must be a
SELECT statement. For each tuple, t,
received on the input stream, S, the
operator replaces the parameters in the
query with the values read from the
corresponding fields in the input tuple
t and then, it executes the query. The
operator produces as many tuples on
the output stream as tuples has the
result set of the query executed on the
data store. Each output tuple is created
either using fields of the incoming
tuple, t, or fields of the result set row
or a combination of them.
UpdateSQL The UpdateSQL operator is in charge
of storing results of the CEP query in a
data store. It requires one input and
one output stream. The schema of
these two streams may be different.
This operator is also configured with a
parameterized query that must be an
update statement, that is, it modifies,
inserts or deletes data in the data store.
For each tuple, t, received on the input
stream S, the UpdateSQL operator
replaces the parameters in the query
with the values from the corresponding
fields in the input tuple and then, it
executes the query updating the data
store. The UpdateSQL operator creates
one output tuple for each input tuple.
The output tuple can be either a copy
of the input tuple or the number of
modified rows in the data store or a
concatenation of the two.
Figure 3 shows an example of the ReadSQL
operator. The operator receives CDRs and fetches
from an external data store the monthly plan (idplan)
of the user making the phone call. The output tuple
is composed by the fields idcaller, duration and
timestamp of the input tuple plus the idplan field
read from the data store.
Figure 3: Example of ReadSQL operator.
5 QUERY LANGUAGE
Programmers can use the operators to generate
continuous queries however, most programmers are
familiar with SQL language. Our proposal is to
provide CEPs with a SQL-like language to ease the
programmer task. PaaS-CEP Query Language (CPL)
is defined as a subset of the traditional SQL
language where tables are replaced by continuous
streams.
It allows to feed and filter events from one
stream to another one, to aggregate information of a
stream, to join or merge events from different
streams. The query language is similar to the one of
Esper (Esper, 2006) however, Esper is a centralized
CEP while our approach is generic and can be
plugged into any available CEP, and targets
distributed CEP.
CPL queries always start with the declaration of
streams and windows structures followed by the
definition of one or more statements over these
streams and windows. Each statement requires at
least one input and one output stream. Input streams
must be defined either before any statements or as
output stream of previous statements. Streams can