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

Method fold_with_option_value

src/sql/src/names.rs:1980–2054  ·  view source on GitHub ↗
(
        &mut self,
        node: mz_sql_parser::ast::WithOptionValue<Raw>,
    )

Source from the content-addressed store, hash-verified

1978 }
1979
1980 fn fold_with_option_value(
1981 &mut self,
1982 node: mz_sql_parser::ast::WithOptionValue<Raw>,
1983 ) -> mz_sql_parser::ast::WithOptionValue<Aug> {
1984 use mz_sql_parser::ast::WithOptionValue::*;
1985 match node {
1986 Sequence(vs) => Sequence(
1987 vs.into_iter()
1988 .map(|v| self.fold_with_option_value(v))
1989 .collect(),
1990 ),
1991 Map(map) => Map(map
1992 .into_iter()
1993 .map(|(k, v)| (k, self.fold_with_option_value(v)))
1994 .collect()),
1995 Value(v) => Value(self.fold_value(v)),
1996 DataType(dt) => DataType(self.fold_data_type(dt)),
1997 Secret(secret) => {
1998 let item_name = self.fold_item_name(secret);
1999 match &item_name {
2000 ResolvedItemName::Item { id, .. } => {
2001 let item = self.catalog.get_item(id);
2002 if item.item_type() != CatalogItemType::Secret {
2003 self.status =
2004 Err(PlanError::InvalidSecret(Box::new(item_name.clone())));
2005 }
2006 }
2007 ResolvedItemName::Cte { .. } => {
2008 self.status = Err(PlanError::InvalidSecret(Box::new(item_name.clone())));
2009 }
2010 ResolvedItemName::Error => {}
2011 }
2012 Secret(item_name)
2013 }
2014 Item(obj) => {
2015 let item_name = self.fold_item_name(obj);
2016 match &item_name {
2017 ResolvedItemName::Item { .. } => {}
2018 ResolvedItemName::Cte { .. } => {
2019 self.status = Err(PlanError::InvalidObject(Box::new(item_name.clone())));
2020 }
2021 ResolvedItemName::Error => {}
2022 }
2023 Item(item_name)
2024 }
2025 UnresolvedItemName(name) => UnresolvedItemName(self.fold_unresolved_item_name(name)),
2026 Ident(name) => Ident(self.fold_ident(name)),
2027 Expr(e) => Expr(self.fold_expr(e)),
2028 ClusterReplicas(replicas) => ClusterReplicas(
2029 replicas
2030 .into_iter()
2031 .map(|r| self.fold_replica_definition(r))
2032 .collect(),
2033 ),
2034 ConnectionKafkaBroker(broker) => ConnectionKafkaBroker(self.fold_kafka_broker(broker)),
2035 ConnectionAwsPrivatelink(privatelink) => {
2036 ConnectionAwsPrivatelink(self.fold_connection_default_aws_privatelink(privatelink))
2037 }

Callers

nothing calls this directly

Calls 15

UnresolvedItemNameClass · 0.85
IdentClass · 0.85
ClusterReplicasClass · 0.85
fold_data_typeMethod · 0.80
fold_item_nameMethod · 0.80
fold_exprMethod · 0.80
SecretClass · 0.70
MapInterface · 0.50
ValueInterface · 0.50
DataTypeClass · 0.50

Tested by

no test coverage detected