accumulate()

The accumulate method is called for each row of data in the query.

The accumulate method updates the state variables with the new row of data and returns the updated state. If the accumulate method returns null, the current values stored in the UDA state variables are not updated.

Example
function accumulate(state,value)
state[1] = state[1] + value
state[2] = state[2] + 1
return state
end