Skip to content
This repository has been archived by the owner on Mar 11, 2024. It is now read-only.

Run pipeline without flushing all the windows #81

Open
Xeli opened this issue Aug 29, 2018 · 2 comments
Open

Run pipeline without flushing all the windows #81

Xeli opened this issue Aug 29, 2018 · 2 comments

Comments

@Xeli
Copy link

Xeli commented Aug 29, 2018

I have a test similar like this one:

    @Test
    public void should_not_fire_window_yet() {
        DataStream<String> testStream = createTimedTestStreamWith("message1")
                .emit("message2")
                .close()
                .timeWindowAll(Time.days(1))
                .reduce((a, b) -> a + b);

        assertStream(testStream, emptyIterableOf(String.class));
    }```

This test fails because it outputs the message "message1message2", even though the window is set to 1 day and normally it should not fire until 24 pass.

Adding some break lines seems to indicate a watermark with timestamp Long.MAX_VALUE is being send, which causes the window the fire.

Is there anyway to to alter this behavior? I'd like the have tests that don't automatically 'fire' the window at the end.
@lofifnc
Copy link
Contributor

lofifnc commented Sep 4, 2018

I have tried implementing this feature. In fact it should be the default behaviour that no max timestamp should be emitted. There is a flushOpenWindowsOnTermination() method which enables the emit of a Long.MAX_VALUE.
But if I remember correctly the engine itself seems to emit a max watermark. I have to debug this myself and get back to you.

@lofifnc
Copy link
Contributor

lofifnc commented Sep 30, 2018

The framework will emit a max watermark if the source has not been cancelled. Which is the case here because the source just runs out of input and stops. There seems to be no way to stop the framework from emitting the watermark. The only solution would be to block the source and then notify some listener outside of the framework to cancel the job/cluster (which seems a little bit over engineered).
I think I have to discuss this with the Flink guys.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants