merge()
After the accumulate phase completes, the merge() method is then used to merge all of the states generated by the accumulate method together into a final state for each group of data. If the merge() method returns null, the current values stored in the UDAF state variables are not updated.
Example
function merge(state1,state2)
state1[1] = state1[1] + state2[1]
state1[2] = state1[2] + state2[2]
return state1
end