Skip to content

[2.0] fix(ingestion): reliably parse epoch and ISO datetime bounds (#36169) - #37427

Merged
TeddyCr merged 1 commit into
2.0from
backport/36169-2.0
Nov 9, 2026
Merged

TeddyCr merged 1 commit into
2.0from
backport/36169-2.0

Conversation

@TeddyCr

@TeddyCr TeddyCr commented Nov 9, 2026 •

Copy link
Copy Markdown
Collaborator

Describe your changes:

Backport of #36169 to 2.0 (source commit 29ee6687cacde7a525052603b3d57d5d5542d3a8).

Fix datetime data-quality bounds that fail to parse or are scaled incorrectly because their string length includes a sign, leading zeroes, or fractional seconds. ISO dates and timezone offsets are parsed consistently, and pandas comparisons preserve microseconds.

Type of change:

  • Bug fix

High-level design:

Carry over numeric-first parsing, the existing absolute-magnitude seconds/milliseconds cutoff, ISO parsing via the existing python-dateutil dependency, and opt-in datetime preservation in shared pandas min/max metrics. Default metric output and dimensional accumulators remain epoch milliseconds.

Conflict resolutions for 2.0:

  • Retain the target branch's pytz-based timezone helpers and existing typing conventions outside changed signatures.
  • Move the source PR's datetime regression cases into test_datetime_bounds.py; 2.0 does not contain the unrelated row-tolerance suite that hosted these tests on main.
  • Add DataFrame/PandasRunner imports required by the target's profiler test module.
  • Include the original timestamp decision record. No new runtime dependency, schema, or migration.

Tests:

Use cases covered

Numeric seconds/milliseconds, fractions, signs, leading zeroes, scientific notation, numeric compact-date precedence, ISO dates/offsets, timezone independence, invalid/non-finite inputs, SQLite/pandas boundary verdicts, microseconds across chunks/nulls, default numeric metrics, and dimensional compatibility.

Unit tests

Python 3.10.18 with models generated from the 2.0 schemas and PYTHONPATH=src:

  • python -m pytest -p no:rerunfailures tests/unit/metadata/utils/test_time_utils.py tests/unit/test_time_utils.py tests/unit/observability/data_quality/validations/test_datetime_bounds.py tests/unit/observability/profiler/pandas/test_datalake_metrics.py -q --tb=short — 134 passed.
  • Regression check using unchanged 2.0 production source with the backported tests: 67 failed, 65 passed. This confirms the tests exercise the missing behavior.
  • Expanded command: python -m pytest -p no:rerunfailures tests/unit/metadata/utils/test_time_utils.py tests/unit/test_time_utils.py tests/unit/observability/data_quality tests/unit/observability/profiler/pandas/test_datalake_metrics.py tests/unit/test_dbt.py tests/unit/topology/database/test_life_cycle_query_mixin.py -q --tb=short --cov=metadata.utils.time_utils --cov=metadata.profiler.metrics.static.min --cov=metadata.profiler.metrics.static.max --cov=metadata.data_quality.validations.column.pandas.columnValuesToBeBetween --cov-report=json:/private/tmp/backport-36169-coverage.json --cov-report=term — 590 passed, no failures before interruption. Stopped the optional expansion during DBT HTTP retry waits (urllib3/util/retry.py); the data-quality subtree and profiler suite had completed. Remaining DBT/lifecycle tests are pending. No coverage percentage is claimed because interruption prevented the report.
  • make py_format and make py_format_check — passed (2,754 files); commit and push hooks passed.
  • make static-checks — blocked by seven missing optional-import errors (pyspark/delta/deltalake/elasticsearch8). The exact same seven errors occur against unchanged 2.0 source in the same environment; no new type errors.
  • The pytest rerun plugin was disabled because its local socket initialization is disallowed in the sandbox. No tests were skipped by this option.
  • Full ingestion suite and Python 3.11/3.12 matrix remain pending CI.

Backend integration tests

Not applicable — no Java or API changes.

Ingestion integration tests

The focused tests execute real in-memory SQLite and pandas validation. External-service integration suites were not run; their shared time-utils imports concern unchanged day-boundary helpers.

Playwright (UI) tests

Not applicable — no UI changes.

Manual testing performed

No manual server/UI test. Independent compatibility review of 20bc524c7279170d8795605f9f49ab7399ea300b against REVIEW.md found no blocking findings. Verified required metric configuration helpers and dependencies exist in 2.0; git diff --check passed.

UI screen recording / screenshots:

Not applicable — no UI changes.

Checklist:

  • Source PR and original issue linked.
  • Datetime regression tests backported and verified against failing baseline.
  • Independent target-branch compatibility review completed.
  • Focused tests and formatting checks passed.
  • Type-check environment limitation and broader pending checks documented.
  • No schema, migration, or workflow edits.

Backport 29ee668. Preserve 2.0 timezone helpers and isolate datetime regression tests from newer row-tolerance behavior.
@TeddyCr
TeddyCr requested a review from a team as a code owner November 9, 2026 16:42
@TeddyCr
TeddyCr requested review from akashverma0786 and removed request for a team November 9, 2026 16:42
@gitar-bot

gitar-bot Bot commented Nov 9, 2026 •

Copy link
Copy Markdown
Code Review ✅ Approved

🟡 Medium risk · Changing epoch/ISO bound parsing and pandas datetime comparisons could alter data-quality validation verdicts for timestamp columns.

Backports datetime data-quality bound parsing to 2.0 so epoch seconds/milliseconds, signed or fractional numerics, and ISO dates with timezone offsets are parsed consistently, with pandas min/max preserving microseconds. No issues found.

Verification

Rules No rules evaluated

Functional validation Not enabled

Set up

Auto-approval Not enabled

Set up

For more verification details, comment gitar display:verbose.

Options

Display: compact → Showing compact verification results.

Comment with these commands to change the behavior for this request:

Compact
gitar display:verbose         

Was this helpful? React with 👍 / 👎 | Powered by Gitar — free for open source

@TeddyCr
TeddyCr merged commit 340f44a into 2.0 Nov 9, 2026
18 of 21 checks passed
@TeddyCr
TeddyCr deleted the backport/36169-2.0 branch November 9, 2026 18:49
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.

2 participants