Skip to content

Fix Polars temporal column stats JSON serialization for tracker - #1675

Open
dgvj-work wants to merge 1 commit into
apache:mainfrom
dgvj-work:fix/polars-temporal-stats-json-safe
Open

Fix Polars temporal column stats JSON serialization for tracker#1675
dgvj-work wants to merge 1 commit into
apache:mainfrom
dgvj-work:fix/polars-temporal-stats-json-safe

Conversation

@dgvj-work

@dgvj-work dgvj-work commented Aug 1, 2026

Copy link
Copy Markdown

Make Polars temporal column stats JSON-safe and cover the #1127 Datetime regression.

Changes

How I tested this

  • pytest ui/sdk/tests/tracking/test_polars_col_stats.py ui/sdk/tests/tracking/test_polars_stats.py (23 passed)
  • pre-commit run ruff-check / ruff-format on the touched files (passed)

Notes

  • On main, temporal columns already avoid the original std() crash by routing through datetime_column_stats with std=0.0, but Hamilton tracker gives an error with datetime columns in polars dataframes #1127 was still open: there was no regression test pinning that Datetime path, and Time/Duration values on the same path were still not JSON-serializable for the tracker payload. This PR closes that loop.

Closes #1127

Checklist

  • PR has an informative and human-readable title (this will be pulled into the release notes)
  • Changes are limited to a single goal (no scope creep)
  • Code passed the pre-commit check & code is left cleaner/nicer than when first encountered.
  • Any change in functionality is tested
  • New functions are documented (with a description, list of inputs, and expected output)
  • Placeholder code is flagged / future TODOs are captured in comments
  • Project documentation has been updated if adding/changing functionality.

Drafted with AI assistance (Cursor); I verified the serialization behavior against polars' temporal dtypes manually and reviewed all test assertions.

@dgvj-work
dgvj-work force-pushed the fix/polars-temporal-stats-json-safe branch 2 times, most recently from a65d947 to 670e8f4 Compare August 1, 2026 05:45
Datetime tracking for apache#1127 already avoids std(); extend the same
datetime stats path so Time and Duration values serialize cleanly,
and add a Datetime regression test matching the reported failure.
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.

Hamilton tracker gives an error with datetime columns in polars dataframes

1 participant