rusackas opened a new pull request, #41489: URL: https://github.com/apache/superset/pull/41489
### SUMMARY The dataset-level **HOURS OFFSET** setting was only ever applied to a single temporal column — the selected time column / base-axis / granularity column, plus any column that declared a `python_date_format`. When a dataset had more than one temporal column, a second temporal column returned by the database as a native datetime kept its raw, un-offset value. This is the long-standing behavior reported in #23167 (still reproducible on 5.0.0). The offset is applied post-query in pandas inside `normalize_df`. The set of columns it touched came from `_collect_dttm_labels`, which intentionally gates raw columns on a declared format (so a plain integer column isn't misread as nanosecond timestamps). That gate also excluded perfectly valid native-datetime temporal columns from getting the offset. This change adds `_offset_only_dttm_cols`: after the parse set is built, the offset (and any time shift) is also applied to any *already-datetime* temporal column the query returns. Columns that arrive as plain integers/strings with no declared format are still skipped, since they can't be safely coerced — so the existing integer-guard behavior is preserved. Test-first: `test_normalize_df_applies_offset_to_all_temporal_columns` pins the bug (two native-datetime temporal columns, both must be shifted by the dataset offset) and fails without the fix. `test_normalize_df_offset_skips_unconfigured_integer_temporal_columns` guards the regression direction (unconfigured integer columns stay untouched). ### BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF N/A — covered by unit tests. The issue thread has repro videos. ### TESTING INSTRUCTIONS 1. Create a dataset with more than one temporal column (e.g. created/expired), where the DB returns them as native datetimes. 2. Set HOURS OFFSET (e.g. 4) on the dataset and save. 3. Build a table chart that returns both temporal columns. 4. All temporal columns should now be shifted by the offset, regardless of which one is the selected time column. Or run: ``` pytest tests/unit_tests/models/helpers_test.py -k normalize_df ``` ### ADDITIONAL INFORMATION - [x] Has associated issue: Fixes #23167 - [ ] Required feature flags: - [ ] Changes UI - [ ] Includes DB Migration - [ ] 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: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
