| 13 | /// Int64 slots at positions 0/1/2 ahead of user columns. |
| 14 | #[test] |
| 15 | fn bitemporal_columnar_schema_shape() { |
| 16 | let base = ColumnarSchema::new(vec![ |
| 17 | ColumnDef::required("id", ColumnType::Int64).with_primary_key(), |
| 18 | ColumnDef::nullable("value", ColumnType::Float64), |
| 19 | ]) |
| 20 | .unwrap(); |
| 21 | |
| 22 | // Mirror `prepend_bitemporal_columns`: three reserved Int64 at slots 0/1/2. |
| 23 | let mut cols = Vec::with_capacity(3 + base.columns.len()); |
| 24 | cols.push(ColumnDef::required("_ts_system", ColumnType::Int64)); |
| 25 | cols.push(ColumnDef::required("_ts_valid_from", ColumnType::Int64)); |
| 26 | cols.push(ColumnDef::required("_ts_valid_until", ColumnType::Int64)); |
| 27 | cols.extend(base.columns); |
| 28 | let bitemporal = ColumnarSchema::new(cols).unwrap(); |
| 29 | |
| 30 | assert_eq!(bitemporal.columns[0].name, "_ts_system"); |
| 31 | assert_eq!(bitemporal.columns[1].name, "_ts_valid_from"); |
| 32 | assert_eq!(bitemporal.columns[2].name, "_ts_valid_until"); |
| 33 | assert_eq!(bitemporal.columns[3].name, "id"); |
| 34 | assert_eq!(bitemporal.columns[4].name, "value"); |
| 35 | assert_eq!(bitemporal.len(), 5); |
| 36 | } |