GoogleCloudPlatform / GoogleCloudPlatform/BigQuery-Agent-Analytics-SDK

adk-2.0 consumer: compaction_windows view (TIMESTAMP_MICROS conversion, fractional fixture)

Open
#216 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
47
Forks
21
Avg merge
2d 13h
Merged PRs (30d)
33

Description

Parent tracker: #190 (v17 contract).
Wave: 5 — Consumer views.
Blocked by: #195 (`attributes.adk.app_name` identity stamping — grouped on), #201 (producer EVENT_COMPACTION), #210 (cross-event deployment plumbing).

## Contract

Per `(JSON_VALUE(attributes, '$.adk.app_name'), user_id, session_id, invocation_id)`, the ranges where rows were collapsed, derived from `EVENT_COMPACTION.content.{start_timestamp, end_timestamp}`.

**Unit conversion is part of the contract.** ADK exposes those fields as float epoch seconds (`event_actions.py:42-45`; matching `Event.timestamp` at `event.py:156`). BQAA top-level `timestamp` is a BigQuery `TIMESTAMP`. Convert via:

```sql
TIMESTAMP_MICROS(CAST( * 1000000 AS INT64))
```

**Do not use `TIMESTAMP_SECONDS()`** — it truncates fractional windows.

## Acceptance

- [ ] `start_ts` / `end_ts` as `TIMESTAMP` (microsecond-preserving conversion).
- [ ] Optional `start_seconds` / `end_seconds` as raw `FLOAT64` retained for diagnostics.
- [ ] **Fractional-timestamp fixture**: a sub-second window survives the conversion (e.g. 1.234s → 1.235s window remains visible, not collapsed to a whole-second range).
- [ ] Null-safe for pre-2.0 rows.

## References

- #190 (v17 consumer view 5; v15 unit conversion contract).
- `src/google/adk/events/event_actions.py:42-45`, `event.py:156`.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.