Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Excerpt
hiddentrue
  Siddhi Wiki for patitions
Info

Note: A single partition definition can be used by multiple queries.

 

<define-partition> ::= define partition <partition-id> by <partition-type> {, <partition-type>}*
<partition-type> := <attribute-name> | range <condition> as <partition-key> {, <attribute-name> | range <condition> as <partition-key>}*

...

Following example shows a sample partition definition;

Defining a partition with an ID 'StockSymbol' which will partition any query that uses this particular partition definition by the 'symbol' attribute of 'stockStream' .

define partition StockSymbol by  stockStream.symbol ;

Currently CEP supports two types of partitioning.

Variable Paritioning
Anchor
Variable Paritioning
Variable Paritioning

Partitions are broken up according to a pre-defined variable. The example above shows a variable partitioning for the variable 'symbol' in 'stockStream'.

Range Partitioning
Anchor
Range Partitioning
Range Partitioning

Partitions are broken up according to the range of a specified variable. The partition key for a particular range must be provided.

Following example shows a sample definition for range partitioning.

Defining a partition with an ID 'StockVolume' which will partition any query that uses this particular partition definition by the range definitions;
namely if volume is less than 10 it will be sent to the partition 'SMALL', if it is between 10 and 100, then it would be sent to 'MEDIUM' partition, else
it would go to partition identified by key 'LARGE'. 

define partition StockVolume by
    range volume < 10 as 'SMALL',  
    range volume >= 10 && volume <= 100 as 'MEDIUM',
    range volume > 100 as 'LARGE' ;

For range partitioning, the partition keys must be specified at the definition.