Hi,
I have a spark-streaming application that basically keeps track of a
string->string dictionary.
So I have messages coming in with updates, like:
"A"->"B"
And I need to update the dictionary.
This seems like a simple use case for the updateStateByKey method.
However, my issue is that when the app starts I need to "initialize" the
dictionary with data from a hive table, that has all the historical key/values
with the dictionary.
The only way I could think of is doing something like:
val rdd =... //get data from hive
def process(input: DStream[(String, String)]) = {
input.join(rdd).updateStateByKey(update)
}
So the join operation will be done on every incoming buffer, where in fact I
only need it on initialization.
Any idea how to achieve that?
Thanks
________________________________
This message is confidential and is for the sole use of the intended
recipient(s). It may also be privileged or otherwise protected by copyright or
other legal rules. If you have received it by mistake please let us know by
reply email and delete it from your system. It is prohibited to copy this
message or disclose its content to anyone. Any confidentiality or privilege is
not waived or lost by any mistaken delivery or unauthorized disclosure of the
message. All messages sent to and from Agoda may be monitored to ensure
compliance with company policies, to protect the company's interests and to
remove potential malware. Electronic messages may be intercepted, amended, lost
or deleted, or contain viruses.