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

Function groups_emit_first

datafusion/functions-aggregate/src/string_agg.rs:870–889  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

868
869 #[test]
870 fn groups_emit_first() -> Result<()> {
871 let mut acc = make_groups_acc(",");
872
873 let values: ArrayRef =
874 Arc::new(LargeStringArray::from(vec!["a", "b", "c", "d", "e", "f"]));
875 let group_indices = vec![0, 1, 2, 0, 1, 2];
876 acc.update_batch(&[values], &group_indices, None, 3)?;
877
878 // Emit only the first 2 groups
879 let result = evaluate_groups(&mut acc, EmitTo::First(2));
880 assert_eq!(
881 result,
882 vec![Some("a,d".to_string()), Some("b,e".to_string())]
883 );
884
885 // Group 2 (now shifted to index 0) should still be intact
886 let result = evaluate_groups(&mut acc, EmitTo::All);
887 assert_eq!(result, vec![Some("c,f".to_string())]);
888 Ok(())
889 }
890
891 #[test]
892 fn groups_merge_batch() -> Result<()> {

Callers

nothing calls this directly

Calls 4

make_groups_accFunction · 0.85
newFunction · 0.85
evaluate_groupsFunction · 0.85
update_batchMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…