title: WSO2 CEP agent broker (KPI Analyzer) sample is not working with aggragate queries
body: <p>I am working on Apache WSO2 CEP and I am trying to do some scenarios that fits my requirements. </p>
  
  <p>First I execute the sample that is explained in this link <a href="http://docs.wso2.org/wiki/display/CEP210/KPI+Analyzer" rel="nofollow">KPI Analyzer</a> and I succced and see the result correctly. After that, I wanted to change the bucket in that sample a little bit from this </p>
  
  <pre><code>from phoneRetailStream[totalPrice&gt;2500 and quantity&gt;3]
  insert into highPurchaseStream
  buyer, brand, quantity, totalPrice; 
  </code></pre>
  
  <p>to this</p>
  
  <pre><code>from phoneRetailStream#window.length(5)
  insert into highPurchaseStream
  sum(quantity) as quantitySum, sum(totalPrice) as totalpriceSum
  group by  brand;
  </code></pre>
  
  <p>and changed the tuple mappings accordingly. But this configuration always gives me the error</p>
  
  <pre><code> [java] Wrongly formatted event sent for carbon.super
   [java] org.wso2.carbon.databridge.core.exception.EventConversionException: Error when converting org.wso2.high.purchase.buyers.new:1.6.0 of event bundle with events 4
   [java]     at org.wso2.carbon.databridge.receiver.thrift.converter.ThriftEventConverter.createEventList(ThriftEventConverter.java:126)
   [java]     at org.wso2.carbon.databridge.receiver.thrift.converter.ThriftEventConverter.toEventList(ThriftEventConverter.java:88)
   [java]     at org.wso2.carbon.databridge.core.internal.queue.QueueWorker.run(QueueWorker.java:72)
   [java]     at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)
   [java]     at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
   [java]     at java.util.concurrent.FutureTask.run(FutureTask.java:138)
   [java]     at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
   [java]     at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
   [java]     at java.lang.Thread.run(Thread.java:662)
   [java] Caused by: java.lang.NullPointerException
   [java]     at org.wso2.carbon.databridge.receiver.thrift.converter.ThriftEventConverter.toObjectArray(ThriftEventConverter.java:49)
   [java]     at org.wso2.carbon.databridge.receiver.thrift.converter.ThriftEventConverter.createEventList(ThriftEventConverter.java:116)
   [java]     ... 8 more
  </code></pre>
  
  <p>I could not use aggration functions (sum, avg etc.) of siddhi language in these samples other than jmsbroker. What may be wrong with this scenario? </p>
  
  <p>@Mohanadarshan</p>
  
  <p>This is the last version of my bucket xml file</p>
  
  <pre><code>&lt;bucket name="KPIAnalyzer" xmlns="http://wso2.org/carbon/cep"&gt;
      &lt;description&gt;
  Notifies when a user purchases more then 3 phones for the total price higher than $2500.
      &lt;/description&gt;
      &lt;engineProviderConfiguration engineProvider="SiddhiCEPRuntime"&gt;
          &lt;property name="siddhi.persistence.snapshot.time.interval.minutes"&gt;0&lt;/property&gt;
          &lt;property name="siddhi.enable.distributed.processing"&gt;false&lt;/property&gt;
      &lt;/engineProviderConfiguration&gt;
      &lt;input topic="org.wso2.phone.retail.store/1.2.0" brokerName="localAgentBroker"&gt;
          &lt;tupleMapping stream="phoneRetailStream" queryEventType="Tuple"&gt;
              &lt;property name="brand" inputName="brand" inputDataType="payloadData"
                        type="java.lang.String"/&gt;
              &lt;property name="quantity" inputName="quantity" inputDataType="payloadData"
                        type="java.lang.Integer"/&gt;
              &lt;property name="totalPrice" inputName="total" inputDataType="payloadData"
                        type="java.lang.Integer"/&gt;
              &lt;property name="buyer" inputName="buyer" inputDataType="payloadData"
                        type="java.lang.String"/&gt;
          &lt;/tupleMapping&gt;
      &lt;/input&gt;
      &lt;query name="KPIQuery"&gt;
          &lt;expression&gt;
  from phoneRetailStream#window.length(5)
  insert into highPurchaseStream
  sum(quantity) as quantitySum, sum(totalPrice) as totalpriceSum
  group by  brand;
          &lt;/expression&gt;
          &lt;output topic="org.wso2.high.purchase.buyers.new/1.6.0" brokerName="externalAgentBroker"&gt;
              &lt;tupleMapping&gt;
                  &lt;metaData&gt;
                  &lt;/metaData&gt;
                  &lt;correlationData/&gt;
                  &lt;payloadData&gt;
                      &lt;property name="quantity" valueOf="quantitySum" type="java.lang.Integer"/&gt;
                      &lt;property name="purchasePrice" valueOf="totalpriceSum" type="java.lang.Integer"/&gt;
                  &lt;/payloadData&gt;
              &lt;/tupleMapping&gt;
          &lt;/output&gt;
      &lt;/query&gt;
  &lt;/bucket&gt;
  </code></pre>
  
  <p>thank you for your help.</p>