Skip to main content

uqa_execution/query/
recheck_source.rs

1//
2// Unified Query Algebra
3//
4// Copyright (c) 2023-2026 Cognica, Inc.
5//
6
7//! Immutable query inputs needed by tuple-lock rechecks.
8
9use crate::query::CteScope;
10use uqa_sql::plan::QueryBlockPlan;
11
12/// Everything needed to rebuild the plan below this `LockRows` boundary for a tuple-local recheck. The statement is the query block as it existed before order-set rewrites; the rebuild replays the same construction the original pipeline used, so the recheck output matches the boundary schema.
13pub struct LockRowsRecheckSource<S: Clone> {
14    pub statement: QueryBlockPlan,
15    pub ctes: CteScope<S>,
16    pub ordered: bool,
17    pub projections: Vec<crate::query::PhysicalProjection>,
18}
19
20impl<S: Clone> LockRowsRecheckSource<S> {
21    pub fn new(statement: &QueryBlockPlan, ctes: &CteScope<S>, ordered: bool) -> Self {
22        Self {
23            statement: statement.clone(),
24            ctes: ctes.clone(),
25            ordered,
26            projections: Vec::new(),
27        }
28    }
29
30    pub fn with_projections(
31        statement: &QueryBlockPlan,
32        ctes: &CteScope<S>,
33        ordered: bool,
34        projections: Vec<crate::query::PhysicalProjection>,
35    ) -> Self {
36        Self {
37            statement: statement.clone(),
38            ctes: ctes.clone(),
39            ordered,
40            projections,
41        }
42    }
43}