Skip to content

Fix: preserve double timestamps for PointValueAggregator and unify event start_ts/end_ts type - #65

Merged
tombonfert merged 2 commits into
mainfrom
fix/point_value_agg_ts_data_type
Jul 23, 2026
Merged

Fix: preserve double timestamps for PointValueAggregator and unify event start_ts/end_ts type#65
tombonfert merged 2 commits into
mainfrom
fix/point_value_agg_ts_data_type

Conversation

@tombonfert

@tombonfert tombonfert commented Jul 23, 2026

Copy link
Copy Markdown
Collaborator

Summary

When a report mixed a PointValueAggregator (PVA) and a StatsAggregator and the channel timestamps were double, the PVA cast point timestamps to long while the StatsAggregator passed double through. This truncated fractional timestamps and, because every event type writes to the shared event_instance_fact table, produced inconsistent column types. In incremental mode this surfaced as a hard failure — DELTA_MERGE_INCOMPATIBLE_DATATYPE: LongType and DoubleType — when a report seeded with long-emitting events (PointsInTimeEvent/ContainerEvent) later had a double-emitting event (BasicEvent) added. (A single full run hid the bug: per-type DataFrames are unioned before the first write, silently widening long→double.)

Changes

  • PointValueAggregator — drop the .cast("long") on point timestamps (point_value_aggregator.py).
  • PointsInTimeEvent — drop the matching .cast("long") so its event_instance_id hash stays consistent with the PVA (points_in_time_event.py).
  • ContainerEvent — cast start_ts/end_ts to double instead of long (container_event.py).

Result: every event type now emits double start_ts/end_ts, so event_instance_fact has a stable double schema from the first write. BasicEvent/SequenceOfEvents already emitted double, so they were unchanged.

Test Plan

  • Unit tests added/updated
  • Manual testing completed
  • Documentation updated (if applicable)

Checklist

  • Code follows project style guidelines
  • Self-review completed
  • No new linter warnings introduced

- Updated PointValueAggregator to remove unnecessary casting of point timestamps to long, preserving original types for start_ts and end_ts.
- Modified ContainerEvent and PointsInTimeEvent classes to cast timestamps to double instead of long, ensuring compatibility with shared event types.
- Enhanced comments to clarify the purpose of timestamp handling in relation to event instance fact tables.
…ports

- Introduced a new test to validate that a mixture of PointsInTimeEvent, ContainerEvent, and BasicEvent can be processed across incremental runs while maintaining a consistent output structure.
- Ensured that all event types agree on the data type for shared timestamp columns (start_ts and end_ts) as double, preventing type conflicts during persistence.
- Enhanced assertions to verify the presence of fact data for all event types after incremental updates, ensuring data integrity across runs.
@tombonfert
tombonfert requested a review from a team as a code owner July 23, 2026 13:21
@tombonfert
tombonfert merged commit 63c6308 into main Jul 23, 2026
5 checks passed
@tombonfert
tombonfert deleted the fix/point_value_agg_ts_data_type branch July 23, 2026 14:07
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