You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add SqlExecutionBudget propagation through executor
Plumbs an optional SqlExecutionBudget through the executor context so
materializing operators can detect runaway resource use and abort with a
structured error indicating which limit was hit.
Budget fields: maxRowsToMaterialize (global row counter across operators),
maxHeapBytes (global byte counter), maxIntermediateBytes (per-operator byte
counter), timeoutMs (wall-clock deadline), allowDerivedColumnScan (opts out
of the scalar aggregate scanColumn fast path).
Operators that materialize now call context.budget?.operator(name).addRow()
before pinning each row: Sort, HashAggregate, ScalarAggregate slow path,
HashJoin and NestedLoopJoin (right side), PositionalJoin (both sides),
Distinct, UNION/INTERSECT/EXCEPT, and Window's non-streaming path. Streaming
loops (filterRows, scanColumnAggregate chunks) check the timeout deadline so
long-running pure-stream queries also abort.
Errors throw a new SqlBudgetError with limit/value/max/operator fields.
Budget passes through Subquery, LATERAL, and correlated subquery contexts.
28 new tests cover each limit reaching threshold, the structured error
shape, fast-path opt-out, and confirm budget-free queries are unchanged.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
0 commit comments