title: Summation of Multiplication of two fields on Cassandra CQL
body: <p>I have stats table.
  stat_date, views (counter), amount (decimal)</p>
  
  <p>I want to multiply fields and aggregate. It works like this in MySQL.</p>
  
  <p>SELECT SUM(views * amount) FROM stats;</p>
  
  <p>But not work on cassandra. Is there a function or an udf for it?</p>
  
  <p>Thanks.</p>
  
  <p>I created udf function for this problem. So this works great.</p>
  
  <pre><code>CREATE OR REPLACE FUNCTION multiplication(input1 counter, input2 double)
  CALLED ON NULL INPUT RETURNS double
  LANGUAGE java AS 'return input1 * input2;';
  </code></pre>
  
  <p>And sum all rows.</p>
  
  <pre><code>SELECT SUM(multiplication(views, amount)) FROM stats;
  </code></pre>