You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@superset.apache.org by "rusackas (via GitHub)" <gi...@apache.org> on 2026/07/25 02:46:43 UTC
[PR] fix(core): don't blank a datetime column when its format coerces every value to NaT [superset]
rusackas opened a new pull request, #42405:
URL: https://github.com/apache/superset/pull/42405
### SUMMARY
When a temporal column's declared `python_date_format` doesn't match its actual data, `pd.to_datetime(..., errors="coerce")` returns all-`NaT`, and `_process_datetime_column` assigned that result unconditionally — silently nulling the entire column.
This surfaces in the **Samples / drill-detail pane**: a chart whose granularity is a temporal column can send that column through normalization with a format that no longer fits the value it receives. Concretely, `video_game_sales.year` is an epoch-millis-backed column that inherits a `%Y` string format; `pd.to_datetime(1136073600000, format="%Y")` → `NaT`, so every `year` value in the Samples tab renders as **N/A**, even though the chart itself renders (its SQL path passes the already-epoch value straight through). Any time-series chart on a dataset with a misfit temporal-column format hits this.
The fix: when a format coerces *every* non-null value to `NaT`, treat it as a mismatch and keep the original values rather than blanking the column. A format that successfully parses any value is applied exactly as before, so no currently-working case changes.
### BEFORE/AFTER
- **Before:** the whole column becomes `NaT` → Samples shows N/A for every row.
- **After:** the original values are kept (a warning is logged), so the column renders.
### TESTING INSTRUCTIONS
`pytest tests/unit_tests/utils/test_core.py -k normalize_dttm` — the new `test_normalize_dttm_col_mismatched_format_keeps_values` fails before the fix (column blanked to NaT) and passes after; the existing normalize tests are unchanged.
### ADDITIONAL INFORMATION
- [ ] Has associated issue:
- [x] Changes UI (the Samples pane rendering)
- [ ] Introduces new feature or API
- [ ] Removes existing feature or API
🤖 Generated with [Claude Code](https://claude.com/claude-code)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [PR] fix(core): don't blank a datetime column when its format coerces every value to NaT [superset]
Posted by "codecov[bot] (via GitHub)" <gi...@apache.org>.
codecov[bot] commented on PR #42405:
URL: https://github.com/apache/superset/pull/42405#issuecomment-5076531270
## [Codecov](https://app.codecov.io/gh/apache/superset/pull/42405?dropdown=coverage&src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) Report
:x: Patch coverage is `0%` with `4 lines` in your changes missing coverage. Please review.
:white_check_mark: Project coverage is 56.00%. Comparing base ([`8c37d62`](https://app.codecov.io/gh/apache/superset/commit/8c37d627aa9c8351e7e60611cd3e1219495bb830?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)) to head ([`339d6ca`](https://app.codecov.io/gh/apache/superset/commit/339d6cac7079eb68c12d9595d3699d703be1dba8?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)).
| [Files with missing lines](https://app.codecov.io/gh/apache/superset/pull/42405?dropdown=coverage&src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | Patch % | Lines |
|---|---|---|
| [superset/utils/core.py](https://app.codecov.io/gh/apache/superset/pull/42405?src=pr&el=tree&filepath=superset%2Futils%2Fcore.py&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-c3VwZXJzZXQvdXRpbHMvY29yZS5weQ==) | 0.00% | [4 Missing :warning: ](https://app.codecov.io/gh/apache/superset/pull/42405?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) |
> :exclamation: There is a different number of reports uploaded between BASE (8c37d62) and HEAD (339d6ca). Click for more details.
>
> <details><summary>HEAD has 60 uploads less than BASE</summary>
>
>| Flag | BASE (8c37d62) | HEAD (339d6ca) |
>|------|------|------|
>|python|53|1|
>|presto|9|1|
></details>
<details><summary>Additional details and impacted files</summary>
```diff
@@ Coverage Diff @@
## master #42405 +/- ##
==========================================
- Coverage 65.24% 56.00% -9.25%
==========================================
Files 2795 2795
Lines 157643 157646 +3
Branches 36061 36062 +1
==========================================
- Hits 102853 88283 -14570
- Misses 52814 68538 +15724
+ Partials 1976 825 -1151
```
| [Flag](https://app.codecov.io/gh/apache/superset/pull/42405/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | Coverage Δ | |
|---|---|---|
| [hive](https://app.codecov.io/gh/apache/superset/pull/42405/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `?` | |
| [mysql](https://app.codecov.io/gh/apache/superset/pull/42405/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `?` | |
| [postgres](https://app.codecov.io/gh/apache/superset/pull/42405/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `?` | |
| [presto](https://app.codecov.io/gh/apache/superset/pull/42405/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `40.31% <0.00%> (-0.01%)` | :arrow_down: |
| [python](https://app.codecov.io/gh/apache/superset/pull/42405/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `40.31% <0.00%> (-18.72%)` | :arrow_down: |
| [sqlite](https://app.codecov.io/gh/apache/superset/pull/42405/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `?` | |
| [unit](https://app.codecov.io/gh/apache/superset/pull/42405/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `?` | |
Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#carryforward-flags-in-the-pull-request-comment) to find out more.
</details>
[:umbrella: View full report in Codecov by Harness](https://app.codecov.io/gh/apache/superset/pull/42405?dropdown=coverage&src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache).
:loudspeaker: Have feedback on the report? [Share it here](https://about.codecov.io/codecov-pr-comment-feedback/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache).
<details><summary> :rocket: New features to boost your workflow: </summary>
- :snowflake: [Test Analytics](https://docs.codecov.com/docs/test-analytics): Detect flaky tests, report on failures, and find test suite problems.
- :package: [JS Bundle Analysis](https://docs.codecov.com/docs/javascript-bundle-analysis): Save yourself from yourself by tracking and limiting bundle sizes in JS merges.
</details>
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [PR] fix(core): don't blank a datetime column when its format coerces every value to NaT [superset]
Posted by "rusackas (via GitHub)" <gi...@apache.org>.
rusackas merged PR #42405:
URL: https://github.com/apache/superset/pull/42405
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [PR] fix(core): don't blank a datetime column when its format coerces every value to NaT [superset]
Posted by "bito-code-review[bot] (via GitHub)" <gi...@apache.org>.
bito-code-review[bot] commented on PR #42405:
URL: https://github.com/apache/superset/pull/42405#issuecomment-5076516901
AI Code Review is in progress (usually takes 3 to 15 minutes unless it's a very large PR).
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org