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


##########
superset/sql/execution/executor.py:
##########
@@ -404,6 +408,118 @@ def execute_sql_with_cursor(
     return results
 
 
+def _decode_async_results_payload(blob: bytes) -> dict[str, Any]:
+    """
+    Decode a results backend blob written by the async SQL execution task.
+
+    The task stores a zlib-compressed payload serialized either as MessagePack
+    or as UTF-8 JSON, depending on ``RESULTS_BACKEND_USE_MSGPACK``. The format
+    is detected from the payload itself (a JSON object starts with ``{``, which
+    is never the first byte of a MessagePack map), so results stay readable if
+    the setting differs between the writing worker and the reading process.
+
+    :param blob: Compressed payload read from the results backend
+    :returns: The deserialized payload
+    """
+    import msgpack
+
+    from superset.utils import json

Review Comment:
   Fixed the local imports by moving msgpack and superset.utils.json to module 
scope in 3c7c8adf04a9f2a26012a4913289da1437f33592. Regression: 
tests/unit_tests/sql/execution/test_async_results.py::test_async_payload_decoder_uses_module_imports
 (the named cases fail with source at d205c6fd3ac016d58b688b3eec250f974491eb0c 
in a detached scratch worktree and pass at this commit).
   
   Siblings checked:
   - superset/sql/execution/executor.py:412 — fixed in 
3c7c8adf04a9f2a26012a4913289da1437f33592
   - superset/sql/execution/executor.py:1501 — fixed in 
3c7c8adf04a9f2a26012a4913289da1437f33592
   - superset/sql/execution/serialization.py:26 — not affected: already imports 
msgpack at module scope
   - superset/sql/execution/celery_task.py:32 — not affected: already imports 
msgpack and json at module scope
   



##########
docs/developer_docs/extensions/mcp.md:
##########
@@ -28,6 +28,34 @@ under the License.
 
 Model Context Protocol (MCP) integration allows extensions to register custom 
AI agent capabilities that integrate seamlessly with Superset's MCP service. 
Extensions can provide both **tools** (executable functions) and **prompts** 
(interactive guidance) that AI agents can discover and use.
 
+## Python SQL query results

Review Comment:
   Fixed the docs placement by moving the generic Python SQL result contract 
under Backend APIs in development.md in 
3c7c8adf04a9f2a26012a4913289da1437f33592. Regression: 
tests/unit_tests/sql/execution/test_async_results.py::test_python_sql_results_documented_under_backend_apis
 (the named cases fail with source at d205c6fd3ac016d58b688b3eec250f974491eb0c 
in a detached scratch worktree and pass at this commit).
   
   Siblings checked:
   - docs/developer_docs/extensions/development.md:209 — fixed in 
3c7c8adf04a9f2a26012a4913289da1437f33592
   - docs/developer_docs/extensions/mcp.md:31 — fixed in 
3c7c8adf04a9f2a26012a4913289da1437f33592
   - superset-core/src/superset_core/queries/types.py:141 — not affected: the 
existing AsyncQueryHandle contract remains correct; rg found no other docs copy
   



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