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

Function test_with_hashes

datafusion/common/src/hash_utils.rs:1812–1831  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1810
1811 #[test]
1812 fn test_with_hashes() {
1813 let array: ArrayRef = Arc::new(Int32Array::from(vec![1, 2, 3, 4]));
1814 let random_state = RandomState::with_seed(0);
1815
1816 // Test that with_hashes produces the same results as create_hashes
1817 let mut expected_hashes = vec![0; array.len()];
1818 create_hashes([&array], &random_state, &mut expected_hashes).unwrap();
1819
1820 let result = with_hashes([&array], &random_state, |hashes| {
1821 assert_eq!(hashes.len(), 4);
1822 // Verify hashes match expected values
1823 assert_eq!(hashes, &expected_hashes[..]);
1824 // Return a copy of the hashes
1825 Ok(hashes.to_vec())
1826 })
1827 .unwrap();
1828
1829 // Verify callback result is returned correctly
1830 assert_eq!(result, expected_hashes);
1831 }
1832
1833 #[test]
1834 fn test_with_hashes_multi_column() {

Callers

nothing calls this directly

Calls 4

newFunction · 0.85
create_hashesFunction · 0.85
with_hashesFunction · 0.85
to_vecMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…