This is an automated email from the ASF dual-hosted git repository.

sadpandajoe pushed a commit to branch 
ultraset-deep-nested-sidecar-arrow-fallback-py313
in repository https://gitbox.apache.org/repos/asf/superset.git

commit f97e1ddcfdc7ccfec35bf1c8aba9de4aae01681a
Author: Joe Li <[email protected]>
AuthorDate: Fri Oct 23 06:36:12 2026 +0000

    fix(tests): make deep nested sidecar fallback test interpreter-independent
    
    test_deep_nested_sidecar_falls_back_to_arrow relied on 550 levels of
    nesting exceeding the recursion limit in _encode_nested_value. That holds
    on Python 3.11, where each list comprehension adds a frame, but Python
    3.12+ inlines comprehensions (PEP 709), roughly doubling the depth the
    encoder handles. On 3.13 the sidecar is written and decoded, so the
    async result holds the real nested list instead of the expected Arrow
    string fallback.
    
    Raise RecursionError from the encoder explicitly so the test exercises
    the fallback on every supported interpreter.
    
    Co-Authored-By: Claude Opus 5.5 <[email protected]>
---
 tests/unit_tests/sql/execution/test_async_results.py | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/tests/unit_tests/sql/execution/test_async_results.py 
b/tests/unit_tests/sql/execution/test_async_results.py
index 40e66ccb4ab..bcc69ed9a38 100644
--- a/tests/unit_tests/sql/execution/test_async_results.py
+++ b/tests/unit_tests/sql/execution/test_async_results.py
@@ -1328,12 +1328,19 @@ def test_deep_nested_sidecar_falls_back_to_arrow(
     for _ in range(550):
         value = [value]
     result_set = _result_set(["value"], [(value,)])
+    # The depth at which encoding exceeds the recursion limit varies with the
+    # interpreter (Python 3.12 inlines comprehensions), so raise it explicitly.
+    encode = mocker.patch(
+        "superset.sql.execution.serialization._encode_nested_value",
+        side_effect=RecursionError,
+    )
     result = _store_and_read(
         mocker,
         "SELECT value",
         [("SELECT value", result_set, 1.0, 1)],
         write_msgpack=use_msgpack,
     )
+    encode.assert_called_once()
     assert result.status == QueryStatus.SUCCESS, result.error_message
     pd.testing.assert_frame_equal(
         result.statements[0].data,

Reply via email to