()
| 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. |
nothing calls this directly
no test coverage detected