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: [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]

Reply via email to