title: wso2 CEP :: Aggregate functions in "select" clause error
body: <p>I'm trying to write an Execution Plan in wso2's CEP. But I'm getting an error in the select clause if I use the aggregated functions. In my case it is "sum". Please read below for further details:</p>
  
  <hr>
  
  <pre><code>@Export('stream.sla.consolidated.breach:1.0.0')
  define stream ConsolidatedBreachSLA (breach_date string, breach_count_per_day int,request_id int);
  
  @Export('stream.sla.breach.details:1.0.0')
  define stream BreachSLA (request_id int, breach_date string, breach_flag int);
  
  from BreachSLA#window.length(50)
  select breach_date as breach_date,sum(breach_flag) as breach_count_per_day,request_id
  group by breach_date
  having breach_count_per_day &gt; 2
  insert into ConsolidatedBreachSLA;
  </code></pre>
  
  <p><a href="http://i.stack.imgur.com/dqRmd.jpg" rel="nofollow">CEP Error</a></p>
  
  <hr>
  
  <p>But as soon as I remove the "sum" from select clause everything seems to get validated correctly.</p>
  
  <pre><code>from BreachSLA#window.length(50)
  select breach_date as breach_date,breach_flag as breach_count_per_day,request_id
  group by breach_date
  having sum(breach_count_per_day) &gt; 2
  insert into ConsolidatedBreachSLA;
  </code></pre>
  
  <p>The intent is to get the sum of records in the select clause such that the value of the sum could be exported to a publisher.</p>