← Back to Pull requests

[feature] Document layering a monthly cache_parquet over a daily one #89

Merged
ptomecek merged 3 files (145 lines) on Oct 22, 2026 21:25 UTC
View on GitHub
ptomecek ptomecek commented on Oct 22, 2026 16:28 UTC
Author

Description

Adds a "Layer a monthly cache over a daily cache" section to the Query Optimization guide. A long daily cache is many small files that are slow to list and read, especially on S3. Because cache_parquet returns a LazyFrame, a monthly cache can use the daily cache as its upstream. The section shows:

  • compacting: a monthly cache in CacheMode.CACHE over a daily cache in CacheMode.CACHE_ONLY writes monthly files without querying the source;

  • reading with fallback: a monthly cache in CacheMode.READ_ONLY over a daily cache in CacheMode.CACHE serves monthly files where they exist and daily files otherwise, writing nothing to the monthly cache;

  • using ttl/final_after on the monthly layer so a month compacted before it ends is rebuilt until it is complete.
  • test_monthly_cache_over_daily_cache covers compaction and fallback. The API reference now states which months final_after stops refetching and links to the new section.

    Type of Change

  • Bug fix

  • New feature

  • Documentation update

  • Refactor / code cleanup

  • CI / build configuration

  • Other (describe below)
  • Checklist

  • Linting passes (make lint): ran make lint-py lint-docs, passed

  • Tests pass (make test): ran pytest polars_io_tools/tests/io_sources/test_lazy_cache_parquet.py -k monthly_cache_over_daily, passed on Polars 1.44.1, 2.0.0 and 1.37.1; full suite not run

  • New tests added for new functionality

  • Documentation updated (if applicable)

  • Changelog / version bump (if applicable)
  • Diff: 145 lines (+141 / -4) across 3 files Reviewer: timkpaine Review duration: 296m
    All Vouch review confidence checks passed
    Residual risk 0.10 = Change Risk (0.36) × (1 − Review Confidence (0.71)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.36 · 145 lines diff across 3 files
    0.36
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.56 · 1 substantive comment(s)
    0.56
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    70%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    Groq Risk Narration
    AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
    Model 1 · Change Risk Attribution
    SHAP Weights
    Diff Size diff_size
    0.298
    Real PR Conversation Timeline
    3 items
    github-actions[bot] github-actions[bot] commented on Oct 22, 2026 16:35 UTC
    Bot

    Test Results


    2 347 tests  +3   2 272 ✅ +3   1m 24s ⏱️ +7s
        2 suites ±0      75 💤 ±0 
        2 files   ±0       0 ❌ ±0 

    Results for commit 1d1b100c. ± Comparison against base commit 0aa30f16.

    [test-results]:data:application/gzip;base64,H4sIAHlZ2moC/13MSw7CIBSF4a00jB1cKEhxMwZuS0Jsi+ExMu5diorE4f+d5DyIdesSyWVgp4HE7FKLOQednN9LTrx0WVLdRi6/eY0Z8TAm2c9u7l5MiiZWu7UINFhC8OEjIe/d7VF/r2/qTit0n7X7S/Tb5lIJQmdqKAAarkBYCXjWkgJazYAppYVWEx+5QfJ8Adzw1DsKAQAA

    :recycle: This comment has been updated with latest results.

    timkpaine timkpaine approved these changes on Oct 22, 2026 18:36 UTC
    Approved Reviewer

    Approved these changes.

    Reviewers
    Assignees
    ptomecek ptomecek
    Labels
    risk: low confidence: 70.9% reviewed
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 35.7% (MEDIUM) · Higher = larger blast radius
    35.7%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 70.9% · Lower = rushed or shallow review
    70.9%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 10.4% · Safe to merge
    10.4%