Skip to content
Opensource internals
  • Posts

Datafusion

Top-K without a sort: how DataFusion keeps a bounded heap of the k smallest rows

Oct 21, 2026 17 min read Jay Hubbert

Instead of sorting N rows to keep k, DataFusion encodes sort keys in Arrow’s row format, keeps the k best rows in a binary heap, and publishes a dynamic filter so the scan below …

DatafusionExecutionPerformanceInternals

Read more →

DataFusion's DISTINCT Is a GROUP BY, and approx_distinct Is a HyperLogLog Over Hashes

Oct 21, 2026 20 min read Jay Hubbert

Exact DISTINCT becomes a GROUP BY on every column, and the approximate version keeps a 16 KiB HyperLogLog sketch per group, keyed by the hash of the value rather than the value …

DatafusionAggregationPerformanceInternals

Read more →

How DataFusion Approximates Quantiles with a Mergeable t-Digest (and Distinct Counts with HyperLogLog)

Oct 21, 2026 9 min read Jay Hubbert

DataFusion’s approx_percentile_cont compresses values into weighted centroids whose state can be merged across partitions — approximately, not exactly.

DatafusionFunctionsPerformanceInternals

Read more →

No Row-by-Row Interpreter: How DataFusion's Physical Expression Tree Compiles Into Whole-Batch Arrow Kernel Calls

Oct 21, 2026 15 min read Jay Hubbert

DataFusion evaluates a physical expression tree by walking it once per RecordBatch, dispatching on a Rust enum at each node, and handing whole arrays to Arrow kernels — never …

DatafusionArrowPerformanceInternals

Read more →

DataFusion Checks Its Own Optimizer: Plan Invariants as a Debugging and Correctness Net

Oct 21, 2026 8 min read Jay Hubbert

DataFusion validates the plan after every optimizer rule, using a two-level invariant system where the cheap structural checks always run and the expensive semantic checks are …

DatafusionOptimizerCorrectnessInternalsDesign

Read more →

← Newer Page 14 of 15 Older →

© 2026 Jay Hubbert · Built with Hugo 0.168.0

RSS ·