Skip to content

fix: efficient field-stats calculation - #1742

Merged
nikhilsinhaparseable merged 1 commit into
parseablehq:mainfrom
parmesant:field-stats-fix
Aug 6, 2026
Merged

fix: efficient field-stats calculation#1742
nikhilsinhaparseable merged 1 commit into
parseablehq:mainfrom
parmesant:field-stats-fix

Conversation

@parmesant

@parmesant parmesant commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

Fixes #XXXX.

Description


This PR has:

  • been tested to ensure log ingestion and log query works.
  • added comments explaining the "why" and the intent of the code wherever would not be obvious for an unfamiliar reader.
  • added documentation for new or modified features or behaviors.

Summary by CodeRabbit

  • Performance

    • Improved field statistics processing for string and string-view data.
    • Reduced overhead when tracking distinct values, especially for high-cardinality fields.
  • Bug Fixes

    • Improved correctness when limiting tracked distinct values.
    • Ensured null and string value handling remains consistent across supported data types.

@coderabbitai

coderabbitai Bot commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 885a5a93-077f-4737-b8e6-b1007fa21f45

📥 Commits

Reviewing files that changed from the base of the PR and between 636e920 and f023599.

📒 Files selected for processing (1)
  • src/storage/field_stats.rs

Walkthrough

This PR updates field_stats string value collection and bounded distinct-value tracking. It adds Utf8 and Utf8View fast paths, switches count storage to FxHashMap, introduces a cached min_count_hint, and extends tests for eviction behavior, null handling, and high-cardinality cases.

Changes

Field statistics tracking

Layer / File(s) Summary
String extraction and null representation
src/storage/field_stats.rs
The code imports Cow and FxHashMap, adds the shared NULL_VALUE constant, and adds Utf8 and Utf8View fast paths that pass borrowed string values into field-stat collection.
Bounded count-state updates
src/storage/field_stats.rs
FieldCountState now uses FxHashMap and stores min_count_hint. record_value, merged-value handling, and track_value now accept Cow<'_, str> and update hint-based eviction logic.
Tracking validation and benchmark coverage
src/storage/field_stats.rs
Tests now cover stale minimum-hint eviction, parity between Utf8 and Utf8View fast paths including nulls, and an ignored high-cardinality benchmark.

Estimated code review effort: 3 (Moderate) | ~25 minutes

Possibly related PRs

  • parseablehq/parseable#1679: Both PRs modify src/storage/field_stats.rs bounded-cardinality tracking and minimum-count eviction behavior.

Suggested reviewers: nikhilsinhaparseable

Poem

Rabbit paws tap field_stats tonight,
Borrowed strings hop in light and bright.
Utf8 and views now race as one,
Small hints help counts decide who won.
🐇 Nulls line up in tidy rows.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description retains the template placeholders and provides no goal, rationale, key changes, issue reference, or completed validation details. Replace the placeholders with the PR goal, solution rationale, key changes, issue reference if applicable, and completed testing, comments, and documentation checklist items.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely identifies the main change: improving field-stats calculation efficiency.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Comment @coderabbitai help to get the list of available commands.

@nikhilsinhaparseable
nikhilsinhaparseable merged commit fc36117 into parseablehq:main Aug 6, 2026
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants