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/05/20 22:59:48 UTC

Re: [PR] fix(charts): handle PostgreSQL INTERVAL type in bar and pie charts [superset]

rusackas commented on PR #34513:
URL: https://github.com/apache/superset/pull/34513#issuecomment-4503326409

   Thanks Amin — all three suggestions applied in b3604af4ce:
   
   1. **Dead int/float branch removed.** You're right, psycopg2/3 always hand back `datetime.timedelta` for INTERVAL — the branch was unreachable in practice. Dropped it; the defensive `return None` at the end still covers any unexpected non-timedelta value.
   
   2. **`.__func__` + `# type: ignore` gone.** Moved `_normalize_interval` to a module-level function (above the class). `column_type_mutators` now references it directly. Cleaner, mypy-clean, and matches the MySQL pattern's spirit (just module-level rather than inline lambda, since the body's too long for a lambda).
   
   3. **`logger.warning` added.** The defensive return-None branch now logs `Cannot normalize PostgreSQL INTERVAL value of type %s to numeric; returning None.` so a future driver surfacing something other than timedelta gets diagnosed rather than silently dropped.
   
   Test was tightened in the same shot — the numeric/bool assertions that exercised the removed branch now exercise the defensive return-None path instead. Same expectations, but for the right reason.
   
   Pre-commit clean (including mypy).


-- 
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