FrancescoCastaldi opened a new pull request, #43585:
URL: https://github.com/apache/superset/pull/43585

   ### SUMMARY
   Fixes #43356.
   
   \ChartDataProphetOptionsSchema.time_grain\ was validating against 
\get_time_grain_choices()\, which includes operator-configured 
\TIME_GRAIN_ADDONS\. However, \prophet()\ in \pandas_postprocessing/prophet.py\ 
resolves time grains through \PROPHET_TIME_GRAIN_MAP\ (a static mapping to 
Pandas frequency strings). Consequently, custom time grains configured in 
\TIME_GRAIN_ADDONS\ passed schema validation but failed at runtime with 
\InvalidPostProcessingError: Unsupported time grain\.
   
   #### Changes
   1. Updated \ChartDataProphetOptionsSchema.time_grain\ in 
\superset/charts/schemas.py\ to validate against 
\PROPHET_TIME_GRAIN_MAP.keys()\ directly.
   2. Updated tests in \        ests/unit_tests/charts/test_schemas.py\ to 
verify that custom non-built-in \TIME_GRAIN_ADDONS\ (e.g. \PT7M\) are rejected 
by \ChartDataProphetOptionsSchema\ while still accepted by 
\ChartDataExtrasSchema\ (\ ime_grain_sqla\).
   
   ### TESTING INSTRUCTIONS
   1. Run \pytest tests/unit_tests/charts/test_schemas.py\.
   2. Configure a custom \TIME_GRAIN_ADDONS\ in config.
   3. Validate that requests targeting Prophet forecasting validate against 
supported Prophet grains and fail with a \ValidationError\ on unsupported 
grains instead of raising an unhandled 500/post-processing error.
   
   ### ADDITIONAL INFORMATION
   - [x] Has associated issue: Fixes #43356
   - [ ] Changes UI
   - [ ] Requires DB Migration


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