You could do some thing like below, and replace firstd, secondd, thirdd
values within the extension with the computed results.

define stream health_second_der_concat (cluster_id, cluster_instance_id,
network_partition_id, value )

define stream health_second_der_concat_temp (cluster_id,
cluster_instance_id, network_partition_id, value, firstd double, secondd
double, thirdd double)

from health_second_der_concat
select cluster_id, cluster_instance_id, network_partition_id, 0.0 as firstd,
0.0 as secondd, 0.0 as thirdd
insert into health_second_der_concat_temp

from health_second_der_concat_temp [health_description == 'memory_consumption']
   *#window.stratos:secondDerivative(1 min, value, *firstd, secondd, thirdd*)*

select *

   insert into second_derivative_memory_consumption_stats
   partition by health_second_der_cluster_partition;


On Tue, Aug 11, 2015 at 7:18 PM, Pranavan Theivendiram <
pranavan...@cse.mrt.ac.lk> wrote:

> Hi Suho,
>
> The following is sample execution plan query. Here we are getting one
> result as value. Can I get three values using this kind of queries?
>
> *The Query* [1]
> <https://github.com/apache/stratos/blob/master/extensions/cep/artifacts/executionplans/SecondDerivativeOfHealthRequest.xml>
>
> from health_second_der_concat [health_description == 'memory_consumption']
>    *#window.stratos:secondDerivative(1 min, value)* select cluster_id, 
> cluster_instance_id, network_partition_id, value as 
> second_derivative_memory_consumption
>    insert into second_derivative_memory_consumption_stats
>    partition by health_second_der_cluster_partition;
>
> *The annotation in SecondDerivativeWindowProcessor* [2] 
> <https://github.com/apache/stratos/blob/master/extensions/cep/stratos-cep-extension/src/main/java/org/apache/stratos/cep/extension/SecondDerivativeFinderWindowProcessor.java>
>
> @SiddhiExtension(namespace = "stratos", function = "secondDerivative")
>
> Here they are getting only one value. Can you point me out a way that I can 
> have all three here?
>
>
> Thanks
>
>
> *T. Pranavan*
> *BSc Eng Undergraduate| Department of Computer Science & Engineering
> ,University of Moratuwa*
> *Mobile| *0775136836
>
> On 9 August 2015 at 09:27, Sriskandarajah Suhothayan <s...@wso2.com>
> wrote:
>
>> Thats possible, you have to have 3 dummy fields on the input stream which
>> you can populate at the window with the coefficients and output the
>> events. Let me know if there are specific issues
>>
>> Suho
>>
>> On Sun, Aug 9, 2015 at 8:46 AM, Pranavan Theivendiram <
>> pranavan...@cse.mrt.ac.lk> wrote:
>>
>>> Hi Suho,
>>>
>>> In my case, I am generating a second order polynomial(Three
>>> coefficients). I am taking inputs of a 10 minute window.(A sliding window-
>>> every one minute , the window will be get update. New events will come into
>>> the window and the oldest events will get removed from the window)
>>>
>>> Thanks
>>>
>>> *T. Pranavan*
>>> *BSc Eng Undergraduate| Department of Computer Science & Engineering
>>> ,University of Moratuwa*
>>> *Mobile| *0775136836
>>>
>>> On 9 August 2015 at 08:40, Sriskandarajah Suhothayan <s...@wso2.com>
>>> wrote:
>>>
>>>> Time window is to buffer events and expire based on some condition
>>>> (time/length/etc), its not for creating new attributes by default. here the
>>>> expired events are generated to inform the other processes the event have
>>>> expired and hence they can do adjust their calculations based on that. If
>>>> you dont have a avg() kind of aggregate functions on select then you dont
>>>> need to send expired events.
>>>>
>>>> For you predictions how many inputs you have (input attributes used for
>>>> production) and how many outputs will be generated (is it only one co
>>>> efficient value)?
>>>> If you are generating one value then you have to extend an Output
>>>> aggregator. e.g.[1]
>>>>
>>>> Suho
>>>>
>>>> [1]
>>>> https://svn.wso2.org/repos/wso2/carbon/platform/branches/turing/dependencies/commons/siddhi/2.0.0-wso2v5/modules/siddhi-core/src/main/java/org/wso2/siddhi/core/query/selector/attribute/handler/avg/AvgOutputAttributeAggregatorDouble.java
>>>>
>>>> On Sat, Aug 8, 2015 at 5:14 PM, Pranavan Theivendiram <
>>>> pranavan...@cse.mrt.ac.lk> wrote:
>>>>
>>>>> Hi All,
>>>>>
>>>>> I am working on writing a custom TimeWindowProcessor (SlidingWindow)
>>>>> to handle the curvefitting prediction. I followed the this implementation
>>>>> [1] and referred this documentation[2]. In my case, I need to get the
>>>>> events received during the 10 mins and use it for the calculation of the
>>>>> curve fitting and set the co efficient of curve fitting as a event. I am
>>>>> finding it hard to understand how the input events will reach the window
>>>>> processors and how the output events are passed throughout and what is the
>>>>> purpose of the processevent method. Processevent method is called in the
>>>>> run method on the expired events in the TimeWindowProcessor class. But 
>>>>> that
>>>>> is not the case I wanted.  I want to simply remove the expired events, but
>>>>> rather calculate the curve coefficients on active events and to send the
>>>>> coefficient as output events. I am bit confused in flow and out flow to 
>>>>> the
>>>>> TimeWindowProcessor class.
>>>>>
>>>>> If anyone can directly point out the input events in the
>>>>> TimeWindowProcessor class that would be a great help for me.I really 
>>>>> expect
>>>>> a help in the form of the tutorial or some explanations on this or 
>>>>> pointing
>>>>> out some custom TimeWindowProcessor class.
>>>>>
>>>>> Note : I already have written evenformatters and executionplans. This
>>>>> is the point I got stucked. I really can`t find a good explanation about
>>>>> the TimeWindowProcessor class.
>>>>>
>>>>> [1]
>>>>> https://svn.wso2.org/repos/wso2/carbon/platform/branches/turing/dependencies/commons/siddhi/2.0.0-wso2v5/modules/siddhi-core/src/main/java/org/wso2/siddhi/core/query/processor/window/TimeWindowProcessor.java
>>>>> [2]https://docs.wso2.com/display/CEP300/Windows#Windows-timeWindow
>>>>>
>>>>> Thank you.
>>>>>
>>>>>
>>>>> *T. Pranavan*
>>>>> *BSc Eng Undergraduate| Department of Computer Science & Engineering
>>>>> ,University of Moratuwa*
>>>>> *Mobile| *0775136836
>>>>>
>>>>> _______________________________________________
>>>>> Dev mailing list
>>>>> Dev@wso2.org
>>>>> http://wso2.org/cgi-bin/mailman/listinfo/dev
>>>>>
>>>>>
>>>>
>>>>
>>>> --
>>>>
>>>> *S. Suhothayan*
>>>> Technical Lead & Team Lead of WSO2 Complex Event Processor
>>>> *WSO2 Inc. *http://wso2.com
>>>> * <http://wso2.com/>*
>>>> lean . enterprise . middleware
>>>>
>>>>
>>>> *cell: (+94) 779 756 757 <%28%2B94%29%20779%20756%20757> | blog:
>>>> http://suhothayan.blogspot.com/ <http://suhothayan.blogspot.com/>twitter:
>>>> http://twitter.com/suhothayan <http://twitter.com/suhothayan> | linked-in:
>>>> http://lk.linkedin.com/in/suhothayan 
>>>> <http://lk.linkedin.com/in/suhothayan>*
>>>>
>>>
>>>
>>
>>
>> --
>>
>> *S. Suhothayan*
>> Technical Lead & Team Lead of WSO2 Complex Event Processor
>> *WSO2 Inc. *http://wso2.com
>> * <http://wso2.com/>*
>> lean . enterprise . middleware
>>
>>
>> *cell: (+94) 779 756 757 <%28%2B94%29%20779%20756%20757> | blog:
>> http://suhothayan.blogspot.com/ <http://suhothayan.blogspot.com/>twitter:
>> http://twitter.com/suhothayan <http://twitter.com/suhothayan> | linked-in:
>> http://lk.linkedin.com/in/suhothayan <http://lk.linkedin.com/in/suhothayan>*
>>
>
>


-- 

*S. Suhothayan*
Technical Lead & Team Lead of WSO2 Complex Event Processor
*WSO2 Inc. *http://wso2.com
* <http://wso2.com/>*
lean . enterprise . middleware


*cell: (+94) 779 756 757 | blog: http://suhothayan.blogspot.com/
<http://suhothayan.blogspot.com/>twitter: http://twitter.com/suhothayan
<http://twitter.com/suhothayan> | linked-in:
http://lk.linkedin.com/in/suhothayan <http://lk.linkedin.com/in/suhothayan>*
_______________________________________________
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev

Reply via email to