feat: DistinctValueCounts, and exact AffectedRows for precheck rule findings - #64
Merged
Merged
Conversation
…findings their exact affected rows
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.
Closes #63.
ColumnFacts.DistinctValueCounts: every value ofDistinctValueswith the exact number of rows holding it, in the same (first-seen) order. It is empty wheneverDistinctValuesAreCompleteis false, and when complete the counts add up toNonEmptyCount. Values are counted as written and trimmed, soWoodandwoodare two entries.MappingPrecheckrule findings (allowed values, ranges, patterns, lengths, custom rules) now carryAffectedRows, the rows whose value fails, taken from those counts. The bound isRowCountBound.Exact. Without complete counts,AffectedRowsstays null as before.How it works: the profiler already does one frequency-dictionary lookup per non-empty value. While the distinct set is complete, that dictionary now counts every kept value, up to
RetainedDistinctValues. The moment the set stops being complete, the dictionary shrinks back to the 64-key sample of its most frequent entries, so a high-cardinality column costs what it did before.Performance. Analysis, median of 3 alternating runs against
mainon a quiet machine (load average about 3–7), with/usr/bin/timefor peak memory:A first version, before the shrink, cost +2.6 % on the 5M-row csv.
Tests:
DistinctValueCountsTestscovers:AffectedRowsfor a case-insensitive allowed-values rule and forAtLeast/AtMost.