mirror of
https://github.com/apache/superset.git
synced 2026-07-27 17:12:36 +00:00
get_timestamp_expr() only knew how to convert epoch_s/epoch_ms raw values into a proper timestamp before applying a time-grain truncation function; any other python_date_format (e.g. "%Y") fell through and passed the raw value straight into the grain function. On SQLite that means DATETIME(year, 'start of year') interprets a bare integer year as a Julian day number rather than a calendar year, silently returning NULL for every row. This exact pattern ships in Superset's own video_game_sales example dataset (year: BIGINT, is_dttm=true, python_date_format: '%Y'), so any time-grain-truncated chart against it (Nightingale Rose included) returns no data. Add a year_to_dttm() hook (mirroring epoch_to_dttm/epoch_ms_to_dttm) that converts a bare year into a proper date before truncation, implemented for SQLite via printf()-based date construction with an explicit NULL guard (printf() otherwise treats a NULL argument as 0). Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>