DStream.
updateStateByKey
Return a new “state” DStream where the state for each key is updated by applying the given function on the previous state of the key and the new values of the key.
State update function. If this function returns None, then corresponding state key-value pair will be eliminated.