Closed Max-Meldrum closed 2 years ago
It looks nice, I think a benefit with this is that you can have multiple key extractors for the same event type. Is the type of the stream produced by iterator
also a keyed stream or something else?
It looks nice, I think a benefit with this is that you can have multiple key extractors for the same event type. Is the type of the stream produced by
iterator
it also a keyed stream?
I take it would just be a Stream. iterator() -> Stream
We just have Stream
right now, I guess we have to introduce more stream types such as in Flink Stream
/ KeyedStream
/ WindowStream
?
Flink seems to have:
One possible way of defining key_by
. Use Builder notion as in other parts of the API and require an extractor + description of how the stream is keyed.
let mut app = Application::with_conf(conf)
.iterator((0..1000000).map(|x| Event { id: x, data: 1.5 }), |conf| {
conf.set_timestamp_extractor(|x: &Event| x.id);
}) // Stream<Event>
.key_by(KeyBuilder {
extractor: Arc::new(|event| event.id),
description: "User Name ID",
}) // KeyedStream<Event>
Currently key(s) are declared through the
Arcon
derive macro that makes sure theget_key()
function is implemented.This is however bit confusing when working with the API. Would be better to have it more explicit and introduce a
KeyExtractor
that the runtime can use (see below).