-
Notifications
You must be signed in to change notification settings - Fork 99
feat: sample add timeseries sampling options
#3130
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
clippy::match-wildcard-for-single-variants
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR adds timeseries sampling functionality to the sample command, allowing users to sample time-series data by grouping records into time intervals and selecting/aggregating records within those intervals. This is particularly useful for downsampling large time-series datasets while preserving temporal patterns.
Key Changes:
- Added
--timeseriesflag and related options (--ts-interval,--ts-start,--ts-adaptive,--ts-aggregate,--ts-input-tz,--ts-prefer-dmy) - Implemented interval-based sampling with support for hourly, daily, weekly, monthly, and yearly intervals
- Added adaptive sampling modes to prefer records from specific time periods (business hours, weekends, business days)
- Included aggregation functions (mean, sum, min, max, median, first, last, count) for combining multiple records within intervals
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 13 comments.
| File | Description |
|---|---|
| src/cmd/sample.rs | Core implementation of timeseries sampling including new enum types (TSStartMode, AggregationFunction, AdaptiveMode), parsing functions for timestamps and intervals, and the main sampling logic with grouping, selection, and aggregation capabilities |
| tests/test_sample.rs | Test suite covering basic timeseries sampling scenarios including daily/hourly intervals, different start modes (first/last), aggregation (mean), and error cases (invalid column, invalid interval) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.
resolves #2589