miller/test/cases/dsl-stats/count/various/mlr
John Kerl d341cc6dd3
DSL functions for summary stats over arrays / maps (#1364)
* DSL stats functions [WIP]

* refactor

* move percentile computation to bifs module; iterate

* mode and antimode

* percentile iterate

* percentile sketching

* neaten

* unit-test iterate

* unify old & new min & max functions

* unit-test cases

* code-dedupe between mode and antimode

* make mode/antimode ties deterministic via first-found-wins rule

* online help strings for new stats DSL functions

* artifacts from `make dev`

* help info on how min/max now recurse into collections

* artifacts from `make dev`

* typofix
2023-08-26 16:02:30 -04:00

26 lines
748 B
Text

end {
outputs = {};
outputs["count_0"] = count(0);
outputs["count_null"] = count(null);
outputs["count_nonesuch"] = count(nonesuch);
outputs["count_empty_array"] = count([]);
outputs["count_array_1"] = count([7]);
outputs["count_array_3"] = count([7,8,9]);
outputs["count_array_nested"] = count([7,[80,90],9]);
outputs["count_empty_map"] = count({});
outputs["count_map_1"] = count({ "a" : 7} );
outputs["count_map_3"] = count({ "a" : 7, "b" : 8, "c" : 9 } );
outputs["count_map_nested"] = count({ "a" : 7, "b" : [80,90], "c" : 9 });
typed_outputs = {};
for (k, v in outputs) {
typed_outputs[k] = v;
typed_outputs[k."_type"] = typeof(v);
}
emit typed_outputs;
}