aminghadersohi commented on code in PR #43680:
URL: https://github.com/apache/superset/pull/43680#discussion_r3897250519
##########
superset/mcp_service/chart/chart_helpers.py:
##########
@@ -62,6 +62,68 @@ class ChartNotOnDashboardError(ValueError):
"""Raised when a chart is not part of the given dashboard's slices."""
+def requested_filter_columns(extra_form_data: dict[str, Any] | None) ->
set[str]:
+ """Return simple column names explicitly requested through extra form
data."""
+ if not extra_form_data:
+ return set()
+
+ columns: set[str] = set()
+ for filter_ in extra_form_data.get("filters", []):
+ if isinstance(filter_, dict) and isinstance(column :=
filter_.get("col"), str):
+ columns.add(column)
+ for filter_ in extra_form_data.get("adhoc_filters", []):
+ if (
+ isinstance(filter_, dict)
+ and filter_.get("expressionType") == "SIMPLE"
+ and isinstance(column := filter_.get("subject"), str)
+ ):
+ columns.add(column)
+ return columns
+
+
+def rejected_columns_in_query(query: Any) -> set[str]:
+ """Return the rejected filter column names reported by one query payload.
+
+ Query construction reports dropped filters as ``rejected_filters`` entries
+ (``{"reason": ..., "column": ...}``), the shape every consumer of a
+ chart-data or query payload sees. The raw ``rejected_filter_columns`` list
+ is still accepted for payloads captured before that conversion.
+ """
+ if not isinstance(query, dict):
+ return set()
+
+ columns = {
+ column
+ for entry in query.get("rejected_filters", [])
+ if isinstance(entry, dict) and isinstance(column :=
entry.get("column"), str)
+ }
Review Comment:
Fixed in c4ad918604. QUERY payloads now preserve the datasource-only
rejected column list, and the MCP helper prefers that list over the combined
temporal/datasource status. This avoids same-name collisions without hiding
real dataset-column rejections. I also added collision coverage.
--
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]