Round / Temporal Layer
Round datetime values to specified time units, similar to pandas round() or SQL DATE_TRUNC(). Supports multiple time granularities and custom intervals.
Example rounding operations:
Input DateTime | Round To | Result | Note |
---|---|---|---|
2024-01-01 12:34:56.789 | 15 Minutes | 2024-01-01 12:30:00 | Quarter hour |
2024-03-15 23:59:59 | 1 Day | 2024-03-16 00:00:00 | Midnight |
2024-07-18 14:30:00 | 1 Month | 2024-08-01 00:00:00 | Month start |
2024-11-28 08:45:30 | 3 Months | 2024-10-01 00:00:00 | Quarter start |
Common applications:
- Time series aggregation
- Data regularization
- Schedule alignment
- Interval analysis
- Performance binning
- Log file processing
Select
columnDatetime column to round. Values will be adjusted to the nearest interval based on specified rounding configuration.
Configuration for rounding interval, combining unit and frequency. Example: 15 Minutes for quarter-hour rounding.
TimeUnit
enumTime units for rounding. Each unit defines the granularity of the rounded result, with calendar units respecting time changes and period boundaries.
Round to nanoseconds (10⁻⁹ s). For ultra-precise scientific or technical data.
Round to microseconds (10⁻⁶ s). For system-level timing analysis.
Round to milliseconds (10⁻³ s). For application performance data.
Round to seconds. Common for log timestamps and human-readable times.
Round to minutes. Useful for scheduling and interval analysis.
Round to hours. Handles DST transitions appropriately.
Round to calendar days (midnight to midnight). Respects DST changes.
Round to calendar weeks (Monday start). Maintains consistent week boundaries.
Round to calendar months. Handles varying month lengths automatically.
Round to calendar quarters (Q1-Q4). Aligns with standard fiscal periods.
Round to calendar years. Handles leap years appropriately.
Round based on row position. For position-based aggregation.
Value
i64Number of units to round to. Examples:
- 15 (with Minutes): Round to nearest 15 minutes
- 4 (with Hours): Round to nearest 4 hours
- 3 (with Months): Round to nearest quarter Must be positive.
AsColumn
nameName for the new column. If not provided, the system generates a unique name. If AsColumn
matches an existing column, the existing column is replaced. The name should follow valid column naming conventions.