Automatic partitioning is the creation of parallel instances of an element and splitting input data across these instances. This can improve the performance of an element and complex projects, which perform computationally expensive operations such as aggregation and joins. This example demonstrates how to create a global parameter to indicate the number of partitions you wish to create.
You can create parallel instances of a delta stream, stream, window, or module. Reference streams, unions, inputs, adapters, splitters, and error streams cannot use partitioning.
DECLARE
PARAMETER integer <NameofParameter> := 3 ;
END;
DECLARE
PARAMETER integer NoOfPartitions := 3 ;
END;
CREATE INPUT WINDOW InputWin SCHEMA (
id integer ,
name string ,
price double )
PRIMARY KEY ( id ) ;
CREATE OUTPUT DELTA STREAM PartitionedWin PRIMARY KEY DEDUCED
PARTITION BY InputWin {
return InputWin.id % PartitionedWin_partitions;
}
PARTITIONS NoOfPartitions
AS SELECT * FROM InputWin ;
where
NoOfPartitions is the global parameter you created prior to
creating the input window (InputWin) and delta stream
(PartitionedWin).