Re: Adding keyed state to test harness before calling process function.
Posted by
Marco Villalobos-2 on
URL: http://deprecated-apache-flink-user-mailing-list-archive.369.s1.nabble.com/Adding-keyed-state-to-test-harness-before-calling-process-function-tp39438p39440.html
Thank you.. I looked into that, but that does not initialize any values in keyed state, instead, it using key state, and lines 407-412 show that is not setting key state values in advanced, handling null values when it is not set in advance.
public void processElement(String value, Context ctx, Collector<Integer> out) throws Exception {
Integer oldCount = counterState.value();
Integer newCount = oldCount != null ? oldCount + 1 : 1;
counterState.update(newCount);
out.collect(newCount);
}
What I mean by initialize keyed state, is that I want to call processElement with values already existing in it.
Hi, Macro
I think you could look at testScalingUp() at flink-state-backends/flink-statebackend-rocksdb/src/test/java/org/apache/flink/contrib/streaming/state/RocksIncrementalCheckpointRescalingTest.java
On Fri, Nov 13, 2020 at 10:36 AM Marco Villalobos <
[hidden email]> wrote:
Hi,
I would like to adding keyed state to test harness before calling process function.
I am using the OneInputStreamOperatorTestHarness.
I can't find any examples online on how to do that, and I am struggling to figure this out.
Can somebody please provide guidance? My test case has keyed state pre-populated as one of its pre-conditions.
Thank you. Sincerely,
Marco