aminghadersohi commented on code in PR #36937:
URL: https://github.com/apache/superset/pull/36937#discussion_r2669190191
##########
superset/mcp_service/chart/tool/get_chart_data.py:
##########
@@ -36,22 +36,30 @@
PerformanceMetadata,
)
from superset.mcp_service.utils.cache_utils import get_cache_status_from_result
+from superset.mcp_service.utils.schema_utils import parse_request
logger = logging.getLogger(__name__)
+# Maximum rows to prevent unbounded fetches and excessive memory/DB load
+MAX_ROW_LIMIT = 10000
+
Review Comment:
Good point! I've updated the logic to respect the chart's configured
row_limit by default:
# Use request.limit if specified, otherwise use chart's configured
# row_limit, with MAX_ROW_LIMIT as safety cap
chart_row_limit = form_data.get("row_limit", 1000)
row_limit = min(request.limit or chart_row_limit, MAX_ROW_LIMIT)
So now:
- Default: Uses the chart's configured row_limit
- Override: request.limit takes precedence (e.g., "show me top 10 from this
chart")
- Safety cap: MAX_ROW_LIMIT (10000) still applies to prevent unbounded
fetches
--
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]