aminghadersohi commented on code in PR #43771:
URL: https://github.com/apache/superset/pull/43771#discussion_r4193070679


##########
superset/mcp_service/chart/plugins/table.py:
##########
@@ -44,6 +46,12 @@ class TableChartPlugin(BaseChartPlugin):
     }
     supports_column_append = True
 
+    def prepare_query_form_data(self, form_data: dict[str, Any]) -> None:
+        """Resolve inherited offsets before the filter merge removes their 
source."""
+        inherited = (form_data.get("extra_form_data") or 
{}).get("time_compare")
+        if inherited and inherited not in 
as_list(form_data.get("time_compare") or []):

Review Comment:
   Fixed in 1eaa25ec3d7d0d4a94a0d59f95b25676487ebaf3. The Table hook uses the 
shared _table_time_offsets resolver before filter preparation consumes 
extra_form_data, so custom is resolved before inherited-offset membership is 
checked. Your example retains both 1 year ago and 2 weeks ago; a nonmatching 
request-level offset still replaces the selection. 
test_table_inherited_custom_offset_preserves_other_comparisons checks 
time_offsets and comparison columns through build_query_dicts_from_form_data 
for Table/AG Grid, including saved-chart viz fallback and request override 
precedence. The matching cases failed before and pass after. Full MCP suite: 
8,146 passed, 4 skipped; pre-commit passed on all branch-changed files.



##########
superset/mcp_service/chart/plugins/xy.py:
##########
@@ -53,6 +58,17 @@ class XYChartPlugin(BaseChartPlugin):
         "echarts_area": "Area Chart",
         "echarts_timeseries_scatter": "Scatter Plot",
     }
+    query_role_keys = BaseChartPlugin.query_role_keys | {"x_axis"}
+
+    def vega_lite_preview(

Review Comment:
   Fixed in 1eaa25ec3d7d0d4a94a0d59f95b25676487ebaf3. XY sets 
resizes_saved_preview=True, preserving the saved-preview width, height, and 
chart-name description framing. 
test_saved_xy_preview_honors_dimensions_and_description exercises 
VegaLitePreviewStrategy.generate for all four XY native types with default 
dimensions and width=800/height=200; it also checks all wide series remain 
present and unsaved previews retain responsive sizing. All eight cases failed 
before and pass after. Full MCP suite: 8,146 passed, 4 skipped; pre-commit 
passed on all branch-changed files.



##########
superset/mcp_service/chart/preview_utils.py:
##########
@@ -1452,33 +1671,35 @@ def _generate_vega_lite_preview_from_data(  # noqa: C901
     mark = viz_to_mark.get(viz_type, "bar")
 
     # Basic Vega-Lite spec
-    spec = {
+    preview_data = _bounded_vega_data(data)
+    spec: dict[str, Any] = {
         "$schema": "https://vega.github.io/schema/vega-lite/v5.json";,
-        "data": {"values": data},
+        "data": {"values": preview_data},
         "mark": mark,
     }
 
     # Get x_axis and metrics from form_data
-    x_axis = form_data.get("x_axis")
+    axis = form_data.get("x_axis")
+    x_axis = get_column_name(axis) if axis else "__timestamp"

Review Comment:
   Addressed in 1eaa25ec3d7d0d4a94a0d59f95b25676487ebaf3. 
test_grouped_timeseries_preview_resolves_legacy_and_sql_axes renders grouped 
wide rows through the plugin renderer for both a legacy chart with no x_axis 
and __timestamp output, and an SQL adhoc axis labelled Month. It asserts 
encoding.x.field and the complete series fold/y/color encodings. Temporarily 
reverting axis normalization made both cases fail (missing x encoding and 
unhashable-dict error); restoring it makes both pass. No renderer change was 
needed. Full MCP suite: 8,146 passed, 4 skipped; pre-commit passed on all 
branch-changed files.



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