bito-code-review[bot] commented on PR #42490:
URL: https://github.com/apache/superset/pull/42490#issuecomment-5119266338

   <!-- Bito Reply -->
   The flagged issue is correct. The current implementation of 
`_bind_dashboard_time_range_filter` in 
`superset/mcp_service/chart/chart_utils.py` prematurely returns if any 
`TEMPORAL_RANGE` filter exists, regardless of whether its subject matches the 
intended `temporal_column` or `x_axis` column. This causes the dashboard to 
ignore explicit temporal column selections when a chart-specific filter on a 
different column is already present.
   
   To resolve this, update the condition to check if the existing 
`TEMPORAL_RANGE` filter's subject matches the requested temporal column. If it 
does not match, you should proceed to add or update the filter.
   
   ```python
   # Proposed fix for superset/mcp_service/chart/chart_utils.py
   
   def _bind_dashboard_time_range_filter(
       form_data: Dict[str, Any], config: ChartConfig, dataset_id: int | str | 
None
   ) -> None:
       # ... existing setup ...
       
       # Check if a TEMPORAL_RANGE filter already exists for the target column
       target_column = getattr(config, "temporal_column", None) or 
form_data.get("x_axis")
       if target_column and any(
           f.get("operator") == FilterOperator.TEMPORAL_RANGE.value and 
f.get("subject") == target_column
           for f in form_data.get("adhoc_filters", [])
       ):
           return
   
       # ... proceed to bind if not already bound ...
   ```
   
   I have checked the PR and there are no other comments in the review 
discussion. Would you like me to proceed with any other adjustments?
   
   **superset/mcp_service/chart/chart_utils.py**
   ```
   target_column = getattr(config, "temporal_column", None) or 
form_data.get("x_axis")
       if target_column and any(
           f.get("operator") == FilterOperator.TEMPORAL_RANGE.value and 
f.get("subject") == target_column
           for f in form_data.get("adhoc_filters", [])
       ):
           return
   ```


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