MCPcopy Create free account
hub / github.com/NodeDB-Lab/nodedb / read_string_column

Function read_string_column

nodedb-columnar/src/reader/block_decode.rs:416–442  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

414
415 #[test]
416 fn read_string_column() {
417 let segment = write_test_segment(50);
418 let reader = SegmentReader::open(&segment).expect("open");
419
420 let col = reader.read_column(1).expect("read name column");
421 match col {
422 DecodedColumn::Binary {
423 data,
424 offsets,
425 valid,
426 } => {
427 assert_eq!(valid.len(), 50);
428 assert!(valid.iter().all(|&v| v));
429 // Check first row.
430 let start = offsets[0] as usize;
431 let end = offsets[1] as usize;
432 let first = std::str::from_utf8(&data[start..end]).expect("utf8");
433 assert_eq!(first, "user_0");
434 // Check last row.
435 let start = offsets[49] as usize;
436 let end = offsets[50] as usize;
437 let last = std::str::from_utf8(&data[start..end]).expect("utf8");
438 assert_eq!(last, "user_49");
439 }
440 _ => panic!("expected Binary (string)"),
441 }
442 }
443
444 #[test]
445 fn read_float64_with_nulls() {

Callers

nothing calls this directly

Calls 4

write_test_segmentFunction · 0.70
openFunction · 0.50
expectMethod · 0.45
read_columnMethod · 0.45

Tested by

no test coverage detected