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

Function extract_float64_column_with_nulls

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

Source from the content-addressed store, hash-verified

431
432 #[test]
433 fn extract_float64_column_with_nulls() {
434 let schema = test_schema();
435 let decoder = TupleDecoder::new(&schema);
436 let rows = vec![
437 vec![
438 Value::Integer(1),
439 Value::String("a".into()),
440 Value::Float(0.75),
441 Value::Bool(true),
442 ],
443 vec![
444 Value::Integer(2),
445 Value::String("b".into()),
446 Value::Null,
447 Value::Bool(false),
448 ],
449 vec![
450 Value::Integer(3),
451 Value::String("c".into()),
452 Value::Float(1.25),
453 Value::Null,
454 ],
455 ];
456 let encoded = encode_rows(&schema, &rows);
457 let refs: Vec<&[u8]> = encoded.iter().map(|v| v.as_slice()).collect();
458
459 let arr = extract_column_to_arrow(&schema, &decoder, &refs, 2).unwrap();
460 let float_arr = arr.as_primitive::<Float64Type>();
461 assert_eq!(float_arr.len(), 3);
462 assert_eq!(float_arr.value(0), 0.75);
463 assert!(float_arr.is_null(1));
464 assert_eq!(float_arr.value(2), 1.25);
465 assert_eq!(float_arr.null_count(), 1);
466 }
467
468 #[test]
469 fn extract_string_column() {

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