Skip to main content

validate_read_then_write

Function validate_read_then_write 

Source
fn validate_read_then_write(
    catalog: &Arc<Catalog>,
    session: &Session,
    plan: &ReadThenWritePlan,
    target_cluster: TargetCluster,
) -> Result<ValidationResult, AdapterError>
Expand description

Validates a read-then-write and resolves the context the rest of the pipeline runs against.

Rejects mz_now() in the selection, the assignments or the returning clause. optimize_mir_read_then_write relies on that rejection by name when it prepares unmaterializable functions one-shot. Also enforces the dependency cap, resolves the target cluster and requires it to have a live replica, honors the session’s replica pin, computes the read side’s TimelineContext, and fetches the target table’s descriptor.

catalog must be the snapshot the plan was built against. One snapshot serves planning, validation and optimization, so items the plan names cannot disappear from it, and the missing-entry branches below are failsafes rather than a live concurrent-DDL path.