Debian Codegraph @

test/cases/dsl-stats/null_count/various/mlr

raw
1 end {
2 outputs = {};
3
4 # Only empty string and JSON-null count as nulls
5
6 outputs["null_count_0"] = null_count(0);
7 outputs["null_count_null"] = null_count(null);
8 outputs["null_count_nonesuch"] = null_count(nonesuch);
9
10 outputs["null_count_empty_array"] = null_count([]);
11 outputs["null_count_array_1"] = null_count([7]);
12 outputs["null_count_array_2"] = null_count([7,8]);
13 outputs["null_count_array_3"] = null_count(["",null,nonesuch]);
14
15 outputs["null_count_empty_map"] = null_count({});
16 outputs["null_count_map_1"] = null_count({ "a" : 7});
17 outputs["null_count_map_2"] = null_count({ "a" : 7, "b" : 8 });
18 outputs["null_count_map_3"] = null_count({ "a" : "", "b" : null, "c" : nonesuch });
19
20 typed_outputs = {};
21
22 for (k, v in outputs) {
23 typed_outputs[k] = v;
24 typed_outputs[k."_type"] = typeof(v);
25 }
26
27 emit typed_outputs;
28 }