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

   Thank you @korbit-ai and @giftig for the thorough review! I've addressed 
both concerns:
   
   ## Changes made:
   
   ### 1. **Enhanced INTERVAL type handling** (addressing @korbit-ai's comment):
   - The mutator now robustly handles multiple data types:
     - `timedelta` objects → converted to total seconds (primary use case from 
psycopg2)
     - Numeric values (int/float) → converted to float for consistency
     - `None` values → converted to 0 (safe for aggregations)
     - String representations → pass through unchanged (preserves PostgreSQL 
string formats for potential frontend handling)
   
   ### 2. **Added documentation and context** (addressing @giftig's comment):
   - Added clear comments explaining why the mutator is needed
   - The mutator normalizes PostgreSQL INTERVAL values specifically for chart 
rendering in bar/pie charts
   - While converting to seconds isn't the most user-friendly display, it 
ensures numeric operations work correctly in charts
   - String representations are preserved for potential future frontend 
formatting improvements
   
   ### 3. **Comprehensive test coverage**:
   - Added tests for all supported data types
   - Tests verify proper handling of edge cases
   - Ensures backward compatibility while improving robustness
   
   The implementation now handles all PostgreSQL INTERVAL formats more reliably 
while maintaining backward compatibility. The conversion to seconds ensures 
charts can perform numeric operations, while preserving string formats leaves 
room for future frontend improvements to display intervals more user-friendly.
   
   All pre-commit checks pass (except pylint due to local environment issues 
unrelated to these changes).


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