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..