New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unable to create time based window using submission params #2494
Comments
It is currently not supported to provide the value to the window via submission parameter when using topology API. Your intention is to have code like below, right?
|
@markheger correct, that would be the intention. |
Instead (high effort), you can write a stateful transform function that keeps a list with your tuples. But you must evict older tuples by yourself from the list so that the window contains only those tuples that have been received within the time window length. In such a function, you can use An example of a stateful function logic is here: Another option (low effort) would be to pass the window length via command line arg of your program that builds and submits your topology:
|
@rnostream thanks for the suggestions. I had already implemented option 2 (command line args) before opening this issue, and will probably stick with that for the time being. That said, I feel the API should allow for a Supplier to be passed in. Option 1 kind of the defeats the purpose of the built in windowing functionality. |
Proposed API changesTwo new methods to declare a window using the value from a submission parameter:
similar API changes for Python topology |
TWindow<T,java.lang.Object> last(Supplier<java.lang.Integer> count) TWindow<T,java.lang.Object> lastSeconds(Supplier<java.lang.Integer> time) |
The Java API [1] for creating a time based window does allow the use of submission time parameters for defining the window length. Therefore it's impossible to dynamically define a window length based on external configuration, and instead must be defined at compile time. Is this by design or is there a workaround for this?
[1] https://github.com/IBMStreams/streamsx.topology/blob/develop/java/src/com/ibm/streamsx/topology/TStream.java#L603
The text was updated successfully, but these errors were encountered: