Timelaketimelake
DocsBenchmarksRoadmapSpecContribute
Apache 2.0 ·
Roadmap

DoneIn progressPlanned

Tables and storage

Done:1. Iceberg tablesDone:2. CommitsDone:3. Object-store catalogIn progress:4. Time-series table contractIn progress:5. File layout and encodingsIn progress:6. Last-value indexDone:7. One-request table state and version checksDone:8. Table format versions and upgradesDone:9. SettingsPlanned:10. Supplemental timestamps

Writing

Done:11. AppendsDone:12. Late data and dedup on readDone:13. Writes from WebAssemblyPlanned:14. Hot tier and seconds-fresh readsPlanned:15. BackfillIn progress:16. Import and migrationPlanned:17. DeletesPlanned:18. GDPR erasure

Maintenance

Done:19. CompactionIn progress:20. Maintenance runs, retention and expiry

Reading

In progress:21. Timelake readerDone:22. Block cacheDone:23. Filter pushdownDone:24. Pruning with long IN listsDone:25. Newest-first scansDone:26. Scans in series orderDone:27. Materialized rollups

SQL functions

In progress:28. Function libraryDone:29. Time buckets and gap fillingDone:30. Signal aggregatesDone:31. Downsampling with m4

Integrations

Planned:32. REST catalogPlanned:33. DuckDB extensionPlanned:34. Snowflake connectionPlanned:35. Multitenancy

Services

Planned:36. Ingestion and rulesPlanned:37. Data to eventsPlanned:38. Static read modelsPlanned:39. Computed metricsPlanned:40. Agent access with permission setsPlanned:41. Device syncPlanned:42. Edge gatewayPlanned:43. Server mode

Benchmarks

In progress:44. Benchmark harness: timebenchIn progress:45. Industrial IoT benchmarkPlanned:46. Agent benchmark

Background

ArchitectureDeployment and cost modelEmbedded engine: DataFusionLandscape and positioningLicense and open corePurpose and requirementsReleases
TimelaketimelakeThe open time-series lakehouse.
v0 · Apache 2.0 · Contribute · GitHubBuilt on Apache Arrow, Apache DataFusion, Apache Parquet, and Apache Iceberg.
DocsBenchmarksRoadmapSpecContribute

Spec 28 · SQL functions

Function library

In progressUpdated 2026-10-20View on GitHub
Versions
0.1.0, 0.7.0, unreleased
Roadmap
Time-series SQL
Related
29. Time buckets and gap filling, 30. Signal aggregates, 31. Downsampling with m4, 33. DuckDB extension

Summary

Time-series SQL functions with descriptive names and pandas aliases: bucketing, gap filling, selection, statistics, quantiles, changes, time-weighted aggregates, downsampling, rolling windows. Functions with a design of their own have their own spec; the rest are listed here with their issues. Built so far: time_bucket, time_buckets, the fills, the signal aggregates, the gap aggregates, m4, and first, last and value_at.

Design

Every function has a plain, descriptive name. Where pandas uses a different name, that name works too, as an alias: forward_fill and ffill are the same function (D22). Polars mostly uses the descriptive names, so they match it.

CategoryFunctions (pandas alias in brackets, where it differs)Status
Bucketingtime_bucket; time_buckets(width, start, end [, origin]), every bucket in a range (date_range) (spec 29)Built (fixed widths)
Gap fillingforward_fill (ffill), backward_fill (bfill), interpolate (spec 29)Built
Time-weightedtime_weighted_mean (forward_fill or linear), integral (spec 30). Critical for IoT because sampling is irregularBuilt
Changescounter_diff and counter_rate, across counter resets (spec 30)Built
States and uptimeTime in a state and uptime: integral(time, condition) and time_weighted_mean(time, condition), a condition counting 1 while true (spec 30; instead of state_duration and uptime)Built
Downsamplingm4(time, value), a group's first, smallest, largest and last points (spec 31)Built
Gapsgap_count(time, threshold) and gap_seconds(time, threshold): how often and how long the readings stopped for longer than a threshold (spec 30)Built
Selectionfirst(time, value), last(time, value), value_at(time, value, at), the latest value at or before a time (asof); ASOF JOINBuilt: names for ordered first_value and last_value; ASOF JOIN in DuckDB's form (ASOF [LEFT] JOIN … ON keys AND l.t >= r.t) and Snowflake's (MATCH_CONDITION)
Quantilesquantile (exact, pandas' linear interpolation), approx_quantile (a t-digest: mergeable sketch state, so it could roll up across buckets)Built; a rollup storing the digest is planned (#125)
Statisticsmean, stddev (std), variance (var), skewness (skew), kurtosis (kurt), corr, covariance (cov), regr_slope, regr_intercept, regr_r2, histogramBuilt: DataFusion's, with the pandas names added; skewness and kurtosis from mergeable moments, as pandas defines them; histogram(x, low, high, bins) as numpy's
Changesdiff, percent_change (pct_change), rate(time, x) (per second), window functionsBuilt
Financeohlc(time, price) (a struct of open, high, low, close; volume is a sum)Built
Downsamplinglttb(time, value, n)Built (keeps a group's readings; m4 is the mergeable one)
Rolling and anomaliesrolling_mean(x, n), rolling_std(x, n) (rolling(n).mean()), zscore, flatlines: flatline_count(time, value, threshold), flatline_seconds(…) (stuck sensors)Built: running sums, 4× faster than a framed avg over 60 rows; flatlines as run aggregates, 34× faster than a window query

Availability by engine:

  • Timelake reader (DataFusion): Full library as Rust UDFs/UDAFs.
  • Plain DuckDB: Functions DuckDB has natively (time_bucket, arg_max, ASOF JOIN, approx_quantile) plus a published SQL macro pack (#127). The macros must use fixed-width intervals (e.g. '24 hours', not '1 day') or date_trunc for UTC data. Calendar-unit buckets on timestamptz take a ~130× slower path in DuckDB (measured in spec 44).
  • DuckDB extension (later): Full parity (spec 33).

Decisions

IDDecisionStatus
D22Every time-series function has a descriptive name, and its pandas name as an alias where that differs (forward_fill / ffill, value_at / asof); "continuous aggregates" are called materialized rollups (spec 27)Accepted

Open questions and issues

  • #124 Functions: value_at (asof) and ASOF JOIN
  • #125 Functions: quantile and approx_quantile with a mergeable sketch
  • #126 Functions: the rest of the library (ohlc, lttb, rolling, zscore, flatline, changes, statistics aliases)
  • #127 DuckDB macro pack for the function library

History

  • 2026-10-11: function library and names (SPEC.md §11, D22)
  • 2026-10-12: time_bucket in v0
  • 2026-10-18: time_weighted_mean, m4
  • 2026-10-19: integral, the counters, conditions, time_buckets and the fills; moved from SPEC.md into spec 24, then into this spec when the specs were regrouped one per feature.
  • 2026-10-19: gap_count and gap_seconds (spec 30).
  • 2026-10-20: first, last and value_at (asof) built (#124).
  • 2026-10-20: the pandas statistics names, skewness and kurtosis, diff, percent_change, rate, rolling_mean, rolling_std and zscore (#126).
  • 2026-10-20: flatline_count and flatline_seconds (#126).
  • 2026-10-20: quantile and approx_quantile (#125).
  • 2026-10-20: ohlc, lttb and histogram; #126 done.
  • 2026-10-20: ASOF JOIN (Snowflake's form): a node of its own, the right side sorted per key and searched; 0.23 s where a range join took 78 s (#124).
  • 2026-10-20: ASOF JOIN in DuckDB's form too; #124 done.
  • 2026-10-20: ASOF JOIN is planned before the optimizer, so a WHERE on the right side's columns applies after each left row's match is found.