uwescience / myria-docs

Documentation for the Myria project
0 stars 1 forks source link

UDA is not a UDA #8

Open domoritz opened 9 years ago

domoritz commented 9 years ago

The myria-docs/myriaql.markdown says that the running mean is a uda but it is in fact a stateful apply if I'm not wrong.

-- User-defined aggregate function
apply RunningMean(value) {
      -- initialize the custom state, set cnt = 0 and summ = 0
      [0 as cnt, 0 as summ];
      -- for each record, add one one to the count (cnt) and add the record value to the sum (summ)
      [cnt + 1 as cnt, summ + value as summ];
      -- on each record, produce the running sum divided by the running count
      s / c;
};

This also needs to be corrected in raco.

CC @BrandonHaynes