You are viewing an old version of this page. View the current version.

Compare with Current View Page History

Version 1 Next »

Odysseus allow to move some query parts to a subsctructe that can be included with the SubQuery-Operator

#ADDQUERY
in = TIMER({PERIOD = 1000,TIMEFROMSTART = true, SOURCE = 'source1'})

in2 = TIMER({PERIOD = 700, TIMEFROMSTART = true, SOURCE = 'source2'})

out = SUBQUERY({NAME='COMPLEX', QUERYFILE = '${PROJECTPATH}/innerQuery.qry'}, in, in2)

out0 = OUTPUTCONNECTOR({PORT = 0, name="Conn1"}, 0:out)
out1 = OUTPUTCONNECTOR({PORT = 1, name="Conn2"}, 1:out)

join = JOIN(in, out1)

Above is a simple example, how this operator can be used.

The subquery operator behaves like any other operator. It can have a name (here complex) and must provide the source of the subquery. This can be a file, contain the querytext (QUERYFILE) or this can be a running query (queryID or queryName), or the query text can be given inside a string (query). In the last case, the parser must be set (if other than Odysseus Script).

The subquery can have 0 to n inputs. If (like in the above example) an input from the outside query is given, connectors need to be defined inside the subquery.

#PARSER PQL
#ADDQUERY
in = CONNECTOR({port = 0, SOURCE = 'connector0', SCHEMA = [['test', 'integer']]})
in2 = CONNECTOR({port = 1, SOURCE = 'connector1', SCHEMA = [['test', 'integer']]})

merged = MERGE(in,in2)

out = FILTER({NAME='Test',PREDICATE = 'test % 2 == 0'},merged)


/// TODO: explain

out0 = OUTPUTCONNECTOR({PORT = 0, name="Conn01"}, 0:out)

out1Input = MAP({EXPRESSIONS = ['counter()','test']},1:out)

out1 = OUTPUTCONNECTOR({PORT = 1, name="Conn02"}, out1Input)

These CONNECTORS behave as sources inside the subquery and allows to connect to the responding element from the outer query. Other queries can connect to this operator via OUTPUTCONNECTOR.

As the CONNECTOR is just a source, is can have all parameters like the Access Operators, i.e. is must provide a name and should provide a schema. With the parameter type, the object type can be set (default is tuple). The port parameter is mapped to the position of the subquery operator.


  • No labels