MCPcopy Create free account
hub / github.com/clockworklabs/SpacetimeDB / table_scan_iter_eq_flatmap

Function table_scan_iter_eq_flatmap

crates/table/src/table.rs:2852–2871  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

2850 // Compare `scan_rows` against a simpler implementation.
2851 #[test]
2852 fn table_scan_iter_eq_flatmap() {
2853 let pool = PagePool::new_for_test();
2854 let mut blob_store = HashMapBlobStore::default();
2855 let mut table = table(AlgebraicType::U64.into());
2856 for v in 0..2u64.pow(14) {
2857 table.insert(&pool, &mut blob_store, &product![v]).unwrap();
2858 }
2859
2860 let complex = table.scan_rows(&blob_store).map(|r| r.pointer());
2861 let simple = table
2862 .inner
2863 .pages
2864 .iter()
2865 .zip((0..).map(PageIndex))
2866 .flat_map(|(page, pi)| {
2867 page.iter_fixed_len(table.row_size())
2868 .map(move |po| RowPointer::new(false, pi, po, table.squashed_offset))
2869 });
2870 assert!(complex.eq(simple));
2871 }
2872
2873 /// Assert that we prefer inserting into lower-`PageIndex` pages when possible,
2874 /// and that `non_full_pages` is correctly updated even for pages with no var-len granules available.

Callers

nothing calls this directly

Calls 10

scan_rowsMethod · 0.80
pointerMethod · 0.80
iter_fixed_lenMethod · 0.80
row_sizeMethod · 0.80
tableFunction · 0.70
insertMethod · 0.65
iterMethod · 0.65
newFunction · 0.50
unwrapMethod · 0.45
mapMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…