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

Method convert

src/sql/src/plan/hir.rs:1067–1084  ·  view source on GitHub ↗
(uncoerced_fields: impl Iterator<Item = CoercibleColumnType>)

Source from the content-addressed store, hash-verified

1065 /// types.
1066 pub fn force_coerced_if_record(&mut self) {
1067 fn convert(uncoerced_fields: impl Iterator<Item = CoercibleColumnType>) -> SqlScalarType {
1068 let mut fields = vec![];
1069 for (i, uf) in uncoerced_fields.enumerate() {
1070 let name = ColumnName::from(format!("f{}", i + 1));
1071 let ty = match uf {
1072 CoercibleColumnType::Coerced(ty) => ty,
1073 CoercibleColumnType::Record(mut fields) => {
1074 convert(fields.drain(..)).nullable(false)
1075 }
1076 CoercibleColumnType::Uncoerced => SqlScalarType::String.nullable(true),
1077 };
1078 fields.push((name, ty))
1079 }
1080 SqlScalarType::Record {
1081 fields: fields.into(),
1082 custom_id: None,
1083 }
1084 }
1085
1086 if let CoercibleScalarType::Record(fields) = self {
1087 *self = CoercibleScalarType::Coerced(convert(fields.drain(..)));

Callers

nothing calls this directly

Calls 5

convertFunction · 0.85
enumerateMethod · 0.80
nullableMethod · 0.45
drainMethod · 0.45
pushMethod · 0.45

Tested by

no test coverage detected