accumulate()
The accumulate method is called for each row of data in the query and 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 UDAF state variables is not updated.
Example
function accumulate(state,value)
state[1] = state[1] + value
state[2] = state[2] + 1
return state
end