compute: allow SUBSCRIBE AS OF MAX UP TO MAX#37611
Open
antiguru wants to merge 3 commits into
Open
Conversation
`DataflowDescription::is_single_time` asserted that an `as_of` of
`Timestamp::MAX` implied an empty `until`. That is not an invariant.
`SUBSCRIBE ... AS OF MAX UP TO MAX` describes an empty range (`as_of`
inclusive equals the exclusive `up_to`), which the adapter accepts and
reports with the `EqualSubscribeBounds` notice. It resolves to
`as_of = {MAX}, until = {MAX}`, tripping the soft assertion. Because soft
assertions panic in test and CI builds, `catch_unwind_optimize` surfaced
it as `internal error in optimizer: internal transform error`.
`MAX` is a legitimate `AS OF` / `UP TO` value. It is only unusable as the
`as_of` of a bounded single-time subscribe, where `until = as_of + 1`
would overflow. The final frontier comparison in `is_single_time` already
classifies both valid `as_of = MAX` frontiers correctly: `until = {}`
(unbounded) is single time, and `until = {MAX}` (empty range) is not. So
the assertion was both wrong and redundant, and is removed.
Adds a `mz-compute-types` unit test covering the three `is_single_time`
frontier cases, and a testdrive regression in `fetch-tail-as-of.td`.
Fixes CLU-169
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
antiguru
commented
Jul 13, 2026
A subscribe whose `as_of` equals its `up_to` covers the empty range `[as_of, up_to)` and is guaranteed to produce no data. Previously it still lowered MIR to LIR, shipped a dataflow to the cluster, installed a sink, and tore it all down to yield nothing. Short-circuit it in `implement_subscribe`, the point where both the coordinator sequencer and frontend subscribe paths converge. When `as_of == up_to`, emit the initial progress row that `ActiveSubscribe::initialize` produces (WITH PROGRESS only), then close the channel to complete the subscribe, skipping dataflow shipping and sink registration. The `is_single_time` assertion removal stays: `is_single_time` runs during MIR to LIR lowering, before `implement_subscribe`, so the empty subscribe would still trip it. The assertion was wrong and redundant regardless. Extends the `fetch-tail-as-of.td` regression with a WITH PROGRESS case that locks the preserved progress-row contract for the short-circuited path. Fixes CLU-169 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
The `as_of <= until` soft assertion message read "expected empty `as_of ≤ until`". The "empty" is a leftover with no meaning here. Drop it. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
SUBSCRIBE ... AS OF MAX UP TO MAXdescribes the empty range[as_of, up_to):as_ofis inclusive and equals the exclusiveup_to.The adapter accepts it and reports the
EqualSubscribeBoundsnotice.It resolves to
as_of = {MAX}, until = {MAX}.Previously the empty subscribe still lowered MIR to LIR, shipped a dataflow to the cluster, installed a sink, and tore it all down to produce nothing.
The
as_of = MAX, until = MAXdataflow also tripped a soft assertion inis_single_timethat wrongly expected an emptyuntilwheneveras_ofwasMAX, whichcatch_unwind_optimizesurfaced asinternal error in optimizer.This short-circuits the empty subscribe in
implement_subscribe, where the coordinator sequencer and frontend subscribe paths converge.When
as_of == up_toit emits the initial progress row fromActiveSubscribe::initialize(WITH PROGRESS only), then closes the channel to complete the subscribe, skipping dataflow shipping and sink registration.The wrong
is_single_timeassertion is removed.is_single_timeruns during MIR to LIR lowering, before the short-circuit, so the empty dataflow still reaches it.try_step_forward(MAX)returnsNone, sountil = {MAX}is correctly classified as not single time anduntil = {}(unbounded) as single time.Fixes CLU-169