aminghadersohi opened a new pull request, #38978: URL: https://github.com/apache/superset/pull/38978
## Summary When `generate_chart` creates an XY chart with a temporal x-axis column (e.g., `order_date`) that differs from the dataset's primary datetime column, opening the chart in Explore triggers a warning: "The X-axis is not on the filters list." This happens because the MCP tool was not adding a `TEMPORAL_RANGE` adhoc filter for the x-axis column, which the Explore frontend expects for dashboard time-range filter binding. ### Changes - **`chart_utils.py`**: Set `granularity_sqla` to the x-axis column in `configure_temporal_handling()` when temporal, ensuring Superset uses the correct column for time filtering instead of defaulting to the dataset's primary datetime column - **`chart_utils.py`**: Add `_ensure_temporal_adhoc_filter()` helper that appends a `TEMPORAL_RANGE` adhoc filter (using existing `FilterOperator` and `NO_TIME_RANGE` constants) when one doesn't already exist for the column — mirrors the Explore UI's own behavior when a user confirms the dialog - **`chart_utils.py`**: Call the helper in `map_xy_config()` after user filters are applied, only for temporal x-axis columns - **`test_chart_utils.py`**: Update existing tests and add 6 new tests for the helper and its integration ### Test plan - [x] All 116 unit tests pass (`pytest tests/unit_tests/mcp_service/chart/test_chart_utils.py`) - [x] Pre-commit passes on changed files - [ ] Create a bar chart via MCP with temporal x-axis different from primary datetime → open in Explore → no warning - [ ] Create a bar chart via MCP with non-temporal x-axis (e.g., BIGINT year) → still works without DATE_TRUNC errors -- 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]
