Skip to content

[FEAT]: Time aligned bucketing and CAs - #29

Merged
SeedyROM merged 4 commits into
mainfrom
feat/time-aligned-buckets-aggregates
Feb 4, 2026
Merged

SeedyROM merged 4 commits into
mainfrom
feat/time-aligned-buckets-aggregates

Conversation

@SeedyROM

@SeedyROM SeedyROM commented Feb 4, 2026 •

Copy link
Copy Markdown
Owner

Pull Request

Type of Change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update
  • Performance improvement
  • Refactoring (no functional changes)
  • Test coverage improvement

Testing

Please describe the tests you ran to verify your changes. Provide instructions so we can reproduce.

  • All existing tests pass (cargo test)
  • Added new tests for new functionality
  • Manually tested with example workloads
  • Tested in single-node mode
  • Tested in cluster mode (if applicable)

Performance Impact

  • No performance impact
  • Performance improvement (include benchmarks)
  • Potential performance regression (justified by other benefits)

Documentation

  • Updated README.md (if needed)
  • Updated relevant docs in docs/ (if needed)
  • Added/updated code comments for complex logic
  • Updated ARCHITECTURE.md (if architectural changes)
  • Added example usage (if new feature)

Adds custom time bucket alignment (origin parameter) to continuous aggregates,
matching TimescaleDB 2.15.0 feature parity. This enables users to align
pre-computed aggregates to custom boundaries like business hours, specific
timezones, or calendar events.

Core Changes:
- Add origin_micros field to ContinuousAggregateMetadata struct
- Update continuous aggregate refresh to use bucket_with_origin()
- Propagate origin through aggregation pipeline

Protobuf API:
- Add optional origin_micros field to CreateContinuousAggregateRequest
- Add optional origin_micros field to ContinuousAggregateInfo

Client Library:
- Add .origin(timestamp_micros) method to ContinuousAggregateBuilder
- Include detailed documentation with business hours example
- Maintain backward compatibility (defaults to origin=0)

Query DSL:
- Support "create continuous aggregate ... bucket 5m origin <timestamp>"
- Optional origin syntax in CREATE CONTINUOUS AGGREGATE commands

Implementation Details:
- Server stores origin_micros in metadata during creation
- Refresh process uses stored origin with TimeBucketedAggregator::new_with_origin()
- Cache keys remain unchanged (origin is part of aggregate definition)

Testing:
- All 504 library tests passing
- All integration tests passing
- Doctest fixed for Client::connect usage

This completes the time-aligned bucketing feature across all interfaces:
regular queries, DSL queries, and continuous aggregates.
@SeedyROM
SeedyROM merged commit 9acdabb into main Feb 4, 2026
6 checks passed
@SeedyROM
SeedyROM deleted the feat/time-aligned-buckets-aggregates branch February 4, 2026 03:02
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.

1 participant