Schedule icon
WorkingDirectory icon
Queries icon
Fail icon
OutputValues icon
Log icon
Switch icon

Parquet Data Skipping Audit with DuckDB

Measure how well a Parquet lake can skip data from its footer statistics with DuckDB, flag scattered layouts and write a verified sorted copy.

Categories
Data

A Parquet lake can be complete and well compacted and still slow: if the filter column is spread over every file, the min/max statistics in the footers cannot skip anything and every query reads everything. This flow measures that for one column from the footers alone, without reading data, and can write a sorted copy to prove the fix.

How it works

  1. build_demo_lake writes a deterministic demo lake of 20 files with DuckDB, unless lake_glob points at your own files.
  2. find_files and inspect_column stop the run with a BLOCKED_ message when the glob matches nothing, the column is missing, has no statistics or holds one value, or the copy folder is unsafe.
  3. audit reads every row-group min/max with parquet_metadata, counts for each range how many others overlap it, and turns that into the share of row groups and files a lookup reads.
  4. In REWRITE_COPY mode with a poor layout, rewrite_copy writes the rows sorted by the column to a new folder and verify_copy checks the row count and a checksum of every row, then measures the copy again.
  5. A Switch routes SKIPPING_OK, TOO_FEW_ROW_GROUPS, SKIPPING_POOR, FIXED, COPY_BELOW_TARGET and COPY_MISMATCH.

What you get

  • The row groups and files read per lookup, the target, and a CSV of the files that overlap the most.
  • On the demo, SCATTERED reads 80 of 80 row groups and the sorted copy about 3 percent, with the same 490,000 rows and checksum.
  • Your files are never changed. A copy that differs in one row fails the run.

Who it's for

  • Data engineers who own Parquet lakes without Delta or Iceberg clustering.
  • Platform teams who want a weekly layout check with an alert.

Why orchestrate this with Kestra

  • Inputs, guards, a Switch and a schedule in one declarative flow, with the failure reason in the execution.
  • on_poor_skipping: FAIL turns a drifting layout into a failed run that can alert.

Prerequisites

  • A Kestra instance with the DuckDB plugin and access to the Parquet files.

Secrets

  • None for local files. Reading s3:// or gs:// paths needs DuckDB storage access that this flow does not set up.

Quick start

  1. Click Execute with the defaults: the demo ends SUCCESS with SKIPPING_POOR.
  2. Execute again with mode: REWRITE_COPY and see FIXED.
  3. Set lake_glob, column and rewrite_to, then enable the weekly trigger.

How to extend

  • Add a Slack or email task on the failure branch, or loop over several columns.
  • Swap the verified copy into your lake with your own tooling.

Links

See How

New to Kestra?

Use blueprints to kickstart your first workflows.