Fix #1639: stats1 null_count with --fr regex gives wrong results#1994
Open
cobyfrombrooklyn-bot wants to merge 1 commit intojohnkerl:mainfrom
Open
Fix #1639: stats1 null_count with --fr regex gives wrong results#1994cobyfrombrooklyn-bot wants to merge 1 commit intojohnkerl:mainfrom
cobyfrombrooklyn-bot wants to merge 1 commit intojohnkerl:mainfrom
Conversation
When using --fr (regex field selector) with stats1 -a null_count, void (empty) field values were unconditionally skipped in ingestWithValueFieldRegexes, causing null_count to always report 0. The non-regex path (ingestWithoutValueFieldRegexes) already had a special case that allows void values through for null_count accumulators. This commit adds the same exception to the regex path. Fixes johnkerl#1639
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
When using
--fr(regex field selector) withstats1 -a null_count, void (empty) field values are always reported as 0, even when there are actual empty fields. Using-fwith explicit field names correctly counts them.Example from #1639:
Root Cause
In
stats1.go,ingestWithoutValueFieldRegexes(the non-regex path) has a special case at line 532 that allows void values through fornull_countaccumulators:But
ingestWithValueFieldRegexes(the regex path) unconditionally skips void values:Fix
Added the same
null_countexception to the regex path, making it consistent with the non-regex path.Test
Added regression test case
test/cases/verb-stats1-regexed-field-names/0008with a pipe-delimited CSV containing empty fields. Verifies that--fr ".*"produces the same null_count results as explicit-f. All 49 stats1-related regression tests pass.Tested locally on macOS ARM (Apple Silicon).