MCPcopy Create free account
hub / github.com/MaterializeInc/materialize / id_gen

Function id_gen

src/sql/src/plan/explain.rs:155–166  ·  view source on GitHub ↗

Create an [`Iterator`] for [`LocalId`] values that are guaranteed to be fresh within the scope of the given [`HirRelationExpr`].

(expr: &HirRelationExpr)

Source from the content-addressed store, hash-verified

153// Create an [`Iterator`] for [`LocalId`] values that are guaranteed to be
154// fresh within the scope of the given [`HirRelationExpr`].
155fn id_gen(expr: &HirRelationExpr) -> impl Iterator<Item = LocalId> + use<> {
156 let mut max_id = 0_u64;
157
158 expr.visit_pre(&mut |expr| {
159 match expr {
160 HirRelationExpr::Let { id, .. } => max_id = std::cmp::max(max_id, id.into()),
161 _ => (),
162 };
163 });
164
165 (max_id + 1..).map(LocalId::new)
166}
167
168impl ScalarOps for HirScalarExpr {
169 fn match_col_ref(&self) -> Option<usize> {

Callers 1

normalize_subqueriesFunction · 0.70

Calls 2

visit_preMethod · 0.45
mapMethod · 0.45

Tested by

no test coverage detected