public ProcessFn( DoFn<InputT, OutputT> fn, Coder<InputT> elementCoder, Coder<RestrictionT> restrictionCoder, WindowingStrategy<InputT, ?> inputWindowingStrategy) { this.fn = fn; this.elementCoder = elementCoder; this.restrictionCoder = restrictionCoder; this.inputWindowingStrategy = inputWindowingStrategy; this.elementTag = StateTags.value( "element", WindowedValue.getFullCoder( elementCoder, inputWindowingStrategy.getWindowFn().windowCoder())); this.restrictionTag = StateTags.value("restriction", restrictionCoder); }
@Test public void testValueEquality() { StateTag<?> fooVarInt1 = StateTags.value("foo", VarIntCoder.of()); StateTag<?> fooVarInt2 = StateTags.value("foo", VarIntCoder.of()); StateTag<?> fooBigEndian = StateTags.value("foo", BigEndianIntegerCoder.of()); StateTag<?> barVarInt = StateTags.value("bar", VarIntCoder.of()); assertEquals(fooVarInt1, fooVarInt2); assertNotEquals(fooVarInt1, fooBigEndian); assertNotEquals(fooVarInt1, barVarInt); }
public MergingActiveWindowSet(WindowFn<Object, W> windowFn, StateInternals state) { this.windowFn = windowFn; StateTag<ValueState<Map<W, Set<W>>>> tag = StateTags.makeSystemTagInternal( StateTags.value( "tree", MapCoder.of(windowFn.windowCoder(), SetCoder.of(windowFn.windowCoder())))); valueState = state.state(StateNamespaces.global(), tag); // Little use trying to prefetch this state since the ReduceFnRunner // is stymied until it is available. activeWindowToStateAddressWindows = emptyIfNull(valueState.read()); originalActiveWindowToStateAddressWindows = deepCopy(activeWindowToStateAddressWindows); }
StateTags.value( "side-input-data-" + sideInput.getTagInternal().getId(), (Coder) IterableCoder.of(sideInput.getCoderInternal()));