Skip to content

fix(ingestion): reliably parse epoch and ISO datetime bounds - #36169

Merged
TeddyCr merged 5 commits into
mainfrom
seer/fix/convert-timestamp-datetime-strings
Nov 3, 2026
Merged

TeddyCr merged 5 commits into
mainfrom
seer/fix/convert-timestamp-datetime-strings

Conversation

@sentry

@sentry sentry Bot commented Oct 24, 2026 •

Copy link
Copy Markdown
Contributor

Describe your changes:

Fix datetime test bounds that fail to parse or are scaled incorrectly because their string length includes a sign, leading zeroes, or fractional seconds. A bound such as 1675227600.125 now remains epoch seconds instead of becoming 1675227.600125.

  • Merge current main and resolve the overlapping ISO-date implementation from fix(ingestion): support ISO datetime strings in convert_timestamp for test bounds #36144.
  • Parse finite numeric values first; use absolute magnitude for the existing 10^12 seconds/milliseconds cutoff.
  • Parse ISO dates/datetimes with the existing python-dateutil dependency, honoring timezone offsets and treating naive values as UTC across supported Python versions.
  • Reuse shared pandas min/max accumulation for datetime validation via preserve_datetime=True, preserving microseconds and handling multiple chunks/nulls. Default accumulators and metric output remain epoch milliseconds, including dimensional min/max validation; the between validator has no separate datetime aggregation loop.
  • Reject invalid dates and non-finite numeric values with a clear ValueError.

Type of change:

  • Bug fix

High-level design:

The shared utility returns seconds since the Unix epoch. Numeric strings take precedence over compact ISO dates. Bare numeric values retain the historical seconds/milliseconds cutoff; explicit ISO strings avoid unit ambiguity. The contract and compatibility tradeoff are recorded in ADR:2026-11-03-timestamp-bounds-use-numeric-values-and-iso-dates.

Tests:

Use cases covered

Seconds/milliseconds, fractions, signs, leading zeroes, scientific notation, numeric compact-date ambiguity, ISO dates, space/T separators, Z/offsets, ordinal/week dates, UTC independence from local timezone, invalid/non-finite inputs, and SQL/pandas success/failure at datetime boundaries.

Unit tests

Current pandas refactor (29e230a3b0e10e09950c18cbd4af3143f0f87136):

  • Python 3.10: pytest tests/unit/metadata/utils/test_time_utils.py tests/unit/test_time_utils.py tests/unit/observability/data_quality/validations/test_between_row_violations.py -q --tb=short — 138 passed.
  • Python 3.10: pytest tests/unit/observability/profiler/pandas/test_datalake_metrics.py -k 'extrema or test_min or test_max or test_time' -q --tb=short — 15 passed, 28 deselected. Covers ISO timezone offsets, microsecond preservation, multiple chunks/nulls, unchanged default milliseconds, numeric output, and configuration isolation.
  • Regression-first: four datetime-preservation cases failed before the shared metric refactor and passed afterward. Two additional grouped datetime min/max cases reproduced a compatibility issue caught in review; both pass with default accumulators kept numeric.
  • make py_format, make py_format_check, make static-checks, and commit hooks passed; type check reported 0 errors, 96 warnings.
  • Automatic GitHub CI for this follow-up commit is pending.

Earlier validation on 4d303c5faa8e874ecead164a2c6fdb9efd50bcd7 (before the shared min/max refactor):

  • GitHub CI Python 3.10 / 3.11 / 3.12: 14,983 passed per version, 7 skipped and 1 expected failure; no test failures.
  • Ingestion operator build, sample ingestion, and idempotency check: passed.
  • Requested ISO/timezone verification: 26 focused parsing tests passed, including positive/negative offsets, Z, and fractional seconds.
  • Locked Python 3.10: 1,203 passed, covering both time utility modules, the full data-quality unit subtree, DBT, and lifecycle-query tests.
  • Python 3.11: 136 focused tests passed.
  • Changed functions convert_timestamp and pandas _run_results: 100% line and branch coverage. Whole-module coverage is 77% and 83%, respectively.
  • make static-checks: 0 errors, 94 existing warnings.
  • make py_format, make py_format_check, lock validation, generated-model freshness, decision-record validation, and commit hooks passed.
  • Regression-first: 11 numeric-parser failures reproduced before the fix; SQL/pandas execution exposed the pandas datetime comparison failure before its fix.

Backend integration tests

Not applicable — no Java/API/schema changes.

Ingestion integration tests

Real in-memory SQLite and pandas tests exercise the changed validator behavior without mocked metrics. External-service integration suites were not run; their time-utils imports use unchanged day-boundary helpers.

Playwright and UI screen recording

Not applicable — no UI changes.

Manual testing performed

Executed the parser under UTC, America/Los_Angeles, and Asia/Kolkata; validated the final committed diff against REVIEW.md with a fresh independent review. Final independent review found no blocking issues at 29e230a3b0e10e09950c18cbd4af3143f0f87136. The preceding review caught a dimensional min/max accumulator compatibility issue; the final commit fixes it and adds two regression tests.

Checklist:

  • Regression tests added for the reported behavior.
  • Self-review against REVIEW.md and independent review completed.
  • Durable parsing contract recorded in an ADR.
  • No schema changes or migrations required.
  • No workflow-file edits.
  • Existing Sentry issue link retained below.

Fixes COLLATE-INGESTION-Y3

@sentry <feedback>: Autofix iterates on these changes
@sentry stop iterating: Autofix stops iterating on this run

This PR was automatically generated by Sentry. You can adjust this setting at any time.

RetriggerView in GreptileConfidence Score: 5/5

The PR appears safe to merge; both previous findings are addressed.

Summary

convert_timestamp() accepts ISO datetime strings while keeping numeric timestamp parsing.

  • Datetime test bounds can use readable dates and numeric timestamps.

Reviews (2) · Last reviewed commit: "fix(ingestion): prevent numeric timestam..." · Reviewed by Greptile

@sentry
sentry Bot requested a review from a team as a code owner October 24, 2026 23:10
@sentry
sentry Bot requested a review from ulixius9 October 24, 2026 23:10
@github-actions

Copy link
Copy Markdown
Contributor

Hi there 👋 Thanks for your contribution!

The OpenMetadata team will review the PR shortly! Once it has been labeled as safe to test, the CI workflows
will start executing and we'll be able to make sure everything is working as expected.

Let us know if you need any help!

@github-actions

Copy link
Copy Markdown
Contributor

Hi there 👋 Thanks for your contribution!

The OpenMetadata team will review the PR shortly! Once it has been labeled as safe to test, the CI workflows
will start executing and we'll be able to make sure everything is working as expected.

Let us know if you need any help!

@TeddyCr TeddyCr added the safe to test Add this label to run secure Github workflows on PRs label Nov 3, 2026
@TeddyCr TeddyCr changed the title fix(ingestion): support ISO datetime strings in convert_timestamp fix(ingestion): reliably parse epoch and ISO datetime bounds Nov 3, 2026
@TeddyCr TeddyCr assigned TeddyCr and unassigned ulixius9 Nov 3, 2026
@sonarqubecloud

sonarqubecloud Bot commented Nov 3, 2026

Copy link
Copy Markdown

@TeddyCr
TeddyCr merged commit 29ee668 into main Nov 3, 2026
67 checks passed
@TeddyCr
TeddyCr deleted the seer/fix/convert-timestamp-datetime-strings branch November 3, 2026 21:10
TeddyCr added a commit that referenced this pull request Nov 9, 2026
Backport 29ee668. Preserve 2.0 timezone helpers and isolate datetime regression tests from newer row-tolerance behavior.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

safe to test Add this label to run secure Github workflows on PRs

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants