| 343 | } |
| 344 | |
| 345 | fn absorb_sparse(&mut self, _schema: &ArraySchema, tile: &SparseTile) -> ArrayResult<()> { |
| 346 | let n = tile.row_count(); |
| 347 | for row in 0..n { |
| 348 | let coord: Vec<CoordValue> = tile |
| 349 | .dim_dicts |
| 350 | .iter() |
| 351 | .map(|d| d.values[d.indices[row] as usize].clone()) |
| 352 | .collect(); |
| 353 | let kind = tile.row_kind(row)?; |
| 354 | let (attrs, surrogate, valid_from_ms, valid_until_ms) = match kind { |
| 355 | RowKind::Live => { |
| 356 | let attrs: Vec<CellValue> = |
| 357 | tile.attr_cols.iter().map(|col| col[row].clone()).collect(); |
| 358 | let surrogate = tile |
| 359 | .surrogates |
| 360 | .get(row) |
| 361 | .copied() |
| 362 | .unwrap_or(nodedb_types::Surrogate::ZERO); |
| 363 | let vf = tile.valid_from_ms.get(row).copied().unwrap_or(0); |
| 364 | let vu = tile |
| 365 | .valid_until_ms |
| 366 | .get(row) |
| 367 | .copied() |
| 368 | .unwrap_or(nodedb_types::OPEN_UPPER); |
| 369 | (attrs, surrogate, vf, vu) |
| 370 | } |
| 371 | RowKind::Tombstone | RowKind::GdprErased => ( |
| 372 | Vec::new(), |
| 373 | nodedb_types::Surrogate::ZERO, |
| 374 | 0, |
| 375 | nodedb_types::OPEN_UPPER, |
| 376 | ), |
| 377 | }; |
| 378 | self.upsert(MergedRow { |
| 379 | coord, |
| 380 | attrs, |
| 381 | surrogate, |
| 382 | valid_from_ms, |
| 383 | valid_until_ms, |
| 384 | kind, |
| 385 | }); |
| 386 | } |
| 387 | Ok(()) |
| 388 | } |
| 389 | |
| 390 | fn absorb_dense(&mut self, _schema: &ArraySchema, _tile: &DenseTile) -> ArrayResult<()> { |
| 391 | Err(nodedb_array::ArrayError::SegmentCorruption { |