fix(hydroflow_lang)!: remove singleton referencer persist::<'static>()
insertion
#1332
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Also enables singletons for
persist()
and ensures that only the'static
lifetime is usedSingletons are supposed to act like
cross_join()
. I.e. if we have this code:It should behave equivalently to
This has a very unintuitive replaying behavior, if
y
receives multiple updates:y
receives an item10
stream
receives an item20
(10, 20)
is emittedy
receives an item11
(11, 20)
is emittedIn this case the item
20
gets emitted twice.To emulate this unintuitive behavior, we currently ensure that a
persist::<'static>()
exists before operator that references the singleton (filter
, in this case). (Note that this is equivalent tocross_join::<'static>()
and notcross_join::<'tick>()
)However singletons also have had a different mechanism that affects this- currently singleton references create a next-stratum constraint, that ensures a singleton referencer must be in a later stratum than the singleton it is referencing.
Note that this actually prevents the example situation above from happening-- the updates to
y
will be received all at once at the start of the next stratum.This means that actually, currently singletons are equivalent to something like:
last()
is a hypothetical operator that only keeps the most recent item output byy
.next_stratum() -> last()
is equivalent toreduce(|acc, item| *acc = item)
(since that comes with a stratum barrier). So technically this is a slightly different behavior than just cross_join, but it is more intuitive.Also fixes #1293
BREAKING CHANGE: removing persist insertion changes the exact way singletons behave