Great Explanation. Thanks. I got the point.
On Aug 12, 2015 12:28 PM, "Reka Thirunavukkarasu" <r...@wso2.com> wrote:

> Hi Pranavan,
>
> from health_grad_processsor
>           select cluster_id, cluster_instance_id, network_partition_id,
> member_id, partition_id, health_description, value,
>         stratos:concat(cluster_id, '-' , cluster_instance_id) as
> health_grad_cluster_network
>           insert into health_grad_concatinator;
>
> from health_grad_concatinator [health_description == 'load_average']
>         #window.stratos:gradient(1 min, value) select cluster_id,
> cluster_instance_id, network_partition_id, value as gradient_load_average
>         insert into gradient_load_average_stats
>         partition by health_grad_cluster_partition;
>
> @Override
>     protected void init(Expression[] parameters,
> QueryPostProcessingElement nextProcessor,
>                         AbstractDefinition streamDefinition, String
> elementId, boolean async,
>                         SiddhiContext siddhiContext) {
>         if (parameters[0] instanceof IntConstant) {
>             timeToKeep = ((IntConstant) parameters[0]).getValue();
>         } else {
>             timeToKeep = ((LongConstant) parameters[0]).getValue();
>         }
>
>         String subjectedAttr = ((Variable)parameters[1]
> ).getAttributeName();
>         subjectedAttrIndex =
> streamDefinition.getAttributePosition(subjectedAttr);
>         subjectedAttrType =
> streamDefinition.getAttributeType(subjectedAttr);
>
>         oldEventList = new ArrayList<RemoveEvent>();
>         if (this.siddhiContext.isDistributedProcessingEnabled()) {
>             newEventList =
> this.siddhiContext.getHazelcastInstance().getList(elementId +
> "-newEventList");
>         } else {
>             newEventList = new ArrayList<InEvent>();
>         }
>
>         if (this.siddhiContext.isDistributedProcessingEnabled()) {
>             window = new SchedulerSiddhiQueueGrid<StreamEvent>(elementId,
> this, this.siddhiContext, this.async);
>         } else {
>             window = new SchedulerSiddhiQueue<StreamEvent>(this);
>         }
>         //Ordinary scheduling
>         window.schedule();
>
>     }
>
> In the above example, whatever prameters you provide in
> #window.stratos:gradient(1 min, value), will be available as parameters[]
> in the init method of the custom processor. In this sample, value is there
> in the input stream definition and out put stream definition. So we read
> the value from the input stream definition and then change the value by
> calculating the gradient and then put the modified value to output stream
> definition.
>
> In you case, get the value from input stream definition and then calculate
> the coefficient. Then you can put thos co-efiicient to output stream
> definition.
>
> Eg: #window.stratos:gradient(1 min, value, first, second, third)
>
> Then read these in your custom processor inside init method and create
> different variables to hold the type and attribute. So that you can
> calculate the coefficient and then put them to the output stream definition.
>
> Let me know, if you need more help on this...
>
> Thanks,
> Reka
>
>
> On Wed, Aug 12, 2015 at 11:39 AM, Reka Thirunavukkarasu <r...@wso2.com>
> wrote:
>
>> Hi Prananvan,
>>
>> sorry..was bit busy in the morning..Sure..will check and reply you back..
>>
>> Thanks,
>> Reka
>>
>> On Tue, Aug 11, 2015 at 10:53 PM, Pranavan Theivendiram <
>> pranavan...@cse.mrt.ac.lk> wrote:
>>
>>> Hi Reka Akka,
>>>
>>> I could not understand what is meant by the value in the following
>>> query. Can you please explain it?
>>>
>>> *#window.stratos:secondDerivative(1 min, value)*
>>>
>>> I found the above query in the commit [1]
>>>
>>> *[1] **http://mail.wso2.org/mailarchive/commits/2014-June/061224.html
>>> <http://mail.wso2.org/mailarchive/commits/2014-June/061224.html>*
>>>
>>> *Thank you.*
>>>
>>>
>>> *Regards,*
>>> *T. Pranavan*
>>> *BSc Eng Undergraduate| Department of Computer Science & Engineering
>>> ,University of Moratuwa*
>>> *Mobile| *0775136836
>>>
>>
>>
>>
>> --
>> Reka Thirunavukkarasu
>> Senior Software Engineer,
>> WSO2, Inc.:http://wso2.com,
>> Mobile: +94776442007
>>
>>
>>
>
>
> --
> Reka Thirunavukkarasu
> Senior Software Engineer,
> WSO2, Inc.:http://wso2.com,
> Mobile: +94776442007
>
>
>

Reply via email to