diff --git a/pkg/transformers/stats1.go b/pkg/transformers/stats1.go index 803a1255f4..163c64f742 100644 --- a/pkg/transformers/stats1.go +++ b/pkg/transformers/stats1.go @@ -578,7 +578,9 @@ func (tr *TransformerStats1) ingestWithValueFieldRegexes( // The accumulator has been initialized with default values; // continue here. (If we were to continue outside of this loop // we would be failing to construct the accumulator.) - continue + if accumulatorName != "null_count" { + continue + } } namedAccumulator.Ingest(valueFieldValue) } diff --git a/test/cases/verb-stats1-regexed-field-names/0008/cmd b/test/cases/verb-stats1-regexed-field-names/0008/cmd new file mode 100644 index 0000000000..b8e93a4b87 --- /dev/null +++ b/test/cases/verb-stats1-regexed-field-names/0008/cmd @@ -0,0 +1 @@ +mlr --icsv --ifs "|" --oxtab stats1 -a null_count --fr ".*" test/input/null-count-pipe.csv diff --git a/test/cases/verb-stats1-regexed-field-names/0008/experr b/test/cases/verb-stats1-regexed-field-names/0008/experr new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/cases/verb-stats1-regexed-field-names/0008/expout b/test/cases/verb-stats1-regexed-field-names/0008/expout new file mode 100644 index 0000000000..8b6366ef8d --- /dev/null +++ b/test/cases/verb-stats1-regexed-field-names/0008/expout @@ -0,0 +1,4 @@ +Id_null_count 0 +Type_null_count 3 +Other Type_null_count 1 +Number_null_count 0 diff --git a/test/input/null-count-pipe.csv b/test/input/null-count-pipe.csv new file mode 100644 index 0000000000..23454ec510 --- /dev/null +++ b/test/input/null-count-pipe.csv @@ -0,0 +1,4 @@ +Id|Type|Other Type|Number +a||foo|1 +b||bar|2 +c|||1