I have a singleton view in a global window that is read from a DoFn. I'm curious if its "correct" to cache that value from the view, or if I need to read it every time.
As a (simplified) example, if I were to generate the view as such: input.getPipeline .apply(Create.of(Collections.singleton[Void](null))) .apply(MapElements.via(new SimpleFunction[Void, JLong]() { override def apply(input: Void): JLong = { Instant.now().getMillis } })).apply(View.asSingleton[JLong]()) and then read it from a DoFn (using context.sideInput), is it guaranteed that: - every instance of the DoFn will read the same value? - The value will never change? If so it seems like it'd be safe to cache the value inside the DoFn. It seems like this would be the case, but I've also seen cases in dataflow where the UI indicates that the MapElements step above produced more than one element, so I'm curious what people have to say. Thanks!