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

Function extract_string_column

nodedb-strict/src/arrow_extract.rs:469–494  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

467
468 #[test]
469 fn extract_string_column() {
470 let schema = test_schema();
471 let decoder = TupleDecoder::new(&schema);
472 let rows = vec![
473 vec![
474 Value::Integer(1),
475 Value::String("hello".into()),
476 Value::Float(1.0),
477 Value::Bool(true),
478 ],
479 vec![
480 Value::Integer(2),
481 Value::String("world".into()),
482 Value::Null,
483 Value::Null,
484 ],
485 ];
486 let encoded = encode_rows(&schema, &rows);
487 let refs: Vec<&[u8]> = encoded.iter().map(|v| v.as_slice()).collect();
488
489 let arr = extract_column_to_arrow(&schema, &decoder, &refs, 1).unwrap();
490 let str_arr = arr.as_any().downcast_ref::<StringArray>().unwrap();
491 assert_eq!(str_arr.len(), 2);
492 assert_eq!(str_arr.value(0), "hello");
493 assert_eq!(str_arr.value(1), "world");
494 }
495
496 #[test]
497 fn extract_bool_column_with_nulls() {

Callers

nothing calls this directly

Calls 6

encode_rowsFunction · 0.85
extract_column_to_arrowFunction · 0.85
collectMethod · 0.80
test_schemaFunction · 0.70
iterMethod · 0.45
as_sliceMethod · 0.45

Tested by

no test coverage detected