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

Function schema_parse_and_synth

src/clusterd-test-driver/src/script.rs:1230–1259  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1228 /// nullability, and `synth_rows` fills it.
1229 #[mz_ore::test]
1230 fn schema_parse_and_synth() {
1231 let columns = vec![
1232 ColumnSpec {
1233 name: "k".to_string(),
1234 ty: "bigint".to_string(),
1235 nullable: false,
1236 },
1237 ColumnSpec {
1238 name: "flag".to_string(),
1239 ty: "boolean".to_string(),
1240 nullable: false,
1241 },
1242 ColumnSpec {
1243 name: "v".to_string(),
1244 ty: "text".to_string(),
1245 nullable: true,
1246 },
1247 ];
1248 let desc = relation_desc(&columns).unwrap();
1249 assert_eq!(desc.arity(), 3);
1250 let types: Vec<_> = desc.iter_types().collect();
1251 assert_eq!(types[0].scalar_type, SqlScalarType::Int64);
1252 assert_eq!(types[1].scalar_type, SqlScalarType::Bool);
1253 assert!(types[2].nullable);
1254
1255 let rows = synth_rows(&desc, 0, 4, 8);
1256 assert_eq!(rows.len(), 4);
1257
1258 assert!(scalar_type_from_str("nope").is_err());
1259 }
1260
1261 /// Tokens type into the right `Cell`s against their column, bare `null` is SQL
1262 /// null (rejected for a non-nullable column), and a bad numeric token errors.

Callers

nothing calls this directly

Calls 5

relation_descFunction · 0.85
synth_rowsFunction · 0.85
unwrapMethod · 0.80
iter_typesMethod · 0.80
collectMethod · 0.45

Tested by

no test coverage detected