Skip to main content

uqa_sql/binding/
context.rs

1//
2// Unified Query Algebra
3//
4// Copyright (c) 2023-2026 Cognica, Inc.
5//
6
7//! Immutable SQL inputs adapted from the active statement scope.
8
9use crate::catalog::{analysis::CatalogReadView, resolution::RelationNameResolution};
10use crate::{
11    plan::{CtePlan, QueryPlan},
12    RowSchema,
13};
14use std::collections::{BTreeMap, BTreeSet};
15use std::sync::Arc;
16
17#[derive(Clone)]
18pub struct BindingContext<'a> {
19    pub catalog: CatalogReadView,
20    pub resolution: RelationNameResolution,
21    pub ctes: BTreeMap<String, RowSchema>,
22    pub deferred_ctes: BTreeMap<String, Arc<CtePlan>>,
23    pub non_returning_ctes: BTreeSet<String>,
24    pub scalar_subqueries: &'a [QueryPlan],
25}
26
27#[cfg(test)]
28mod tests;