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


##########
tests/unit_tests/result_set_test.py:
##########
@@ -621,3 +621,24 @@ def test_empty_result_set_preserves_column_metadata() -> 
None:
     df = result_set.to_pandas_df()
     assert len(df) == 0
     assert list(map(str, df.columns)) == ["id", "name", "created_at"]
+
+
+def test_integers_outside_int64_are_stringified() -> None:
+    """
+    Integers PyArrow cannot hold in int64 must not fail the whole result set.
+
+    MySQL-family ``BIGINT UNSIGNED`` columns return Python ints up to 2**64 - 
1,
+    and ``pa.array`` raises ``OverflowError`` for anything above 2**63 - 1. 
Such a
+    column falls back to strings, which also keeps the exact value that a
+    JavaScript number could not represent.
+    """
+    data = [(1, 18446744073709551615), (2, 0), (3, None)]
+    description = [
+        ("id", "int", None, None, None, None, True),
+        ("ubig", "int", None, None, None, None, True),
+    ]
+    result_set = SupersetResultSet(data, description, BaseEngineSpec)  # type: 
ignore
+
+    df = result_set.to_pandas_df()
+    assert df["id"].tolist() == [1, 2, 3]
+    assert df["ubig"].tolist() == ["18446744073709551615", "0", None]

Review Comment:
   Not applicable: pyproject.toml restricts pandas to >=2.3.3,<2.4 
(requirements/base.txt pins 2.3.3), where this string-column null remains None, 
unlike the unsupported pandas 3 used in the finding.



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