Skip to content

Commit 9213b2d

Browse files
committed
replace another uuid in a name
1 parent 02c4dd1 commit 9213b2d

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

src/sql/src/plan/query.rs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ use mz_expr::{
5252
};
5353
use mz_ore::assert_none;
5454
use mz_ore::collections::CollectionExt;
55+
use mz_ore::id_gen::IdGen;
5556
use mz_ore::option::FallibleMapExt;
5657
use mz_ore::stack::{CheckedRecursion, RecursionGuard};
5758
use mz_ore::str::StrExt;
@@ -77,7 +78,6 @@ use mz_sql_parser::ast::{
7778
WindowFrameBound, WindowFrameUnits, WindowSpec,
7879
};
7980
use mz_sql_parser::ident;
80-
use uuid::Uuid;
8181

8282
use crate::catalog::{CatalogItemType, CatalogType, SessionCatalog};
8383
use crate::func::{self, Func, FuncSpec};
@@ -6042,6 +6042,7 @@ struct AggregateTableFuncVisitor<'a> {
60426042
tables: BTreeMap<Function<Aug>, String>,
60436043
table_disallowed_context: Vec<&'static str>,
60446044
in_select_item: bool,
6045+
id_gen: IdGen,
60456046
err: Option<PlanError>,
60466047
}
60476048

@@ -6054,6 +6055,7 @@ impl<'a> AggregateTableFuncVisitor<'a> {
60546055
tables: BTreeMap::new(),
60556056
table_disallowed_context: Vec::new(),
60566057
in_select_item: false,
6058+
id_gen: Default::default(),
60576059
err: None,
60586060
}
60596061
}
@@ -6171,11 +6173,12 @@ impl<'a> VisitMut<'_, Aug> for AggregateTableFuncVisitor<'a> {
61716173
} = &func
61726174
{
61736175
// Identical table functions can be de-duplicated.
6176+
let unique_id = self.id_gen.allocate_id();
61746177
let id = self
61756178
.tables
61766179
.entry(func)
6177-
.or_insert_with(|| format!("table_func_{}", Uuid::new_v4()));
6178-
// We know this is okay because id is is 11 characters + 36 characters, which is
6180+
.or_insert_with(|| format!("table_func_{unique_id}"));
6181+
// We know this is okay because id is is 11 characters + <=20 characters, which is
61796182
// less than our max length.
61806183
*expr = Expr::Identifier(vec![Ident::new_unchecked(id.clone())]);
61816184
}

0 commit comments

Comments
 (0)