What does CollectionScope.NON mean ?

17 views
Skip to first unread message

je...@sqooba.io

unread,
Feb 27, 2019, 6:06:44 AM2/27/19
to siddhi-user
Hello,

I'm not sure this group is the right place to ask this question, but I didn't find a better channel :)

I'm a siddhi user and recently I was playing with in-memory table and indexed columns. I went into the code to understand how it works under the hood and found the CollectionScope enum which defines a NON value. What does it mean ?

I'm using siddhi 4.3.0.

Thanks
Jean

Mohanadarshan Vivekanandalingam

unread,
Feb 28, 2019, 5:17:11 AM2/28/19
to siddh...@googlegroups.com, Sriskandarajah Suhothayan
HI Jean,

No worries, you have reached to the correct group. 
To answer your question. 

CollectionScope is used to label the expressions when parsing the streaming query. This labeling will help us to generate joining conditions in a proper manner. For example, let's take below example query.  

define stream StockStream (symbol string, price float, volume long);
define stream CheckStockStream (symbol string, volume long); 
define stream UpdateStockStream (symbol string, price float, volume long);

@Index('symbol') 
define table StockTable (symbol string, price float, volume long);

@info(name = 'query1')
from StockStream
insert into StockTable ;

@info(name = 'query2') 
from CheckStockStream join StockTable 
on CheckStockStream.symbol=='ABC'
select CheckStockStream.symbol, StockTable.volume 
insert into OutStream;

In above, let's consider the query2 joining condition (on CheckStockStream.symbol=='ABC'). This joining condition has two expressions. There is a left expression (CheckStockStream.symbol) which is simply a stream attribute access and right expression ('ABC') is a constant value. These two expressions are non-specialized expressions as like table index key and etc.. Then it will be label CollectionScope as NON. But, if you consider the below siddhi application.

define stream StockStream (symbol string, price float, volume long);
define stream CheckStockStream (symbol string, volume long); 
define stream UpdateStockStream (symbol string, price float, volume long);

@Index('symbol') 
define table StockTable (symbol string, price float, volume long);

@info(name = 'query1')
from StockStream
insert into StockTable ;

@info(name = 'query2') 
from CheckStockStream join StockTable 
on CheckStockStream.symbol== StockTable.symbol
select CheckStockStream.symbol, StockTable.volume 
insert into OutStream;

As per the joining condition, right expression is attribute access of an indexed value (symbol) of the in-memory event table then the respective left expression marks the CollectionScope as INDEXED_ATTRIBUTE.

It would be better if you debug some test cases related to the in-memory table. It will give you a better understanding.

P.S: If you have any dev related queries then you can post them in siddhi-user google group.. 

Thanks,
Mohan

--
Siddhi homepage: http://siddhi.io/
Siddhi Github repo: https://github.com/siddhi-io/siddhi
 
You received this message because you are subscribed to the Google Groups "Siddhi-user" group.
To post to this group, send email to siddh...@googlegroups.com
To unsubscribe from this group, send email to siddhi-user...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/siddhi-user?hl=en?hl=en
---
You received this message because you are subscribed to the Google Groups "siddhi-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to siddhi-user...@googlegroups.com.
To post to this group, send email to siddh...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


--
V. Mohanadarshan | Senior Technical Lead | WSO2 Inc. |
(M) 94-771117673 | (E) mo...@wso2.com |
GET INTEGRATION AGILE
Integration Agility for Digitally Driven Business
Reply all
Reply to author
Forward
0 new messages