MCPcopy Create free account
hub / github.com/apache/datafusion / test_take

Function test_take

datafusion/execution/src/memory_pool/mod.rs:600–617  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

598
599 #[test]
600 fn test_take() {
601 let pool = Arc::new(GreedyMemoryPool::new(50)) as _;
602 let mut r1 = MemoryConsumer::new("r1").register(&pool);
603
604 r1.try_grow(20).unwrap();
605 let r2 = r1.take();
606 r2.try_grow(5).unwrap();
607
608 assert_eq!(r1.size(), 0);
609 assert_eq!(r2.size(), 25);
610 assert_eq!(pool.reserved(), 25);
611
612 // r1 can still grow again
613 r1.try_grow(3).unwrap();
614 assert_eq!(r1.size(), 3);
615 assert_eq!(r2.size(), 25);
616 assert_eq!(pool.reserved(), 28);
617 }
618
619 #[test]
620 fn test_downcast() {

Callers

nothing calls this directly

Calls 4

newFunction · 0.85
registerMethod · 0.45
try_growMethod · 0.45
takeMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…