aminghadersohi commented on code in PR #44743:
URL: https://github.com/apache/superset/pull/44743#discussion_r4129925601
##########
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:
Fixed in 72aff9b0c32c0b70ed6a6e1cb8de0a5290c74f22: the regression test
checks the exact non-null integer strings separately and uses pd.isna for the
null element, covering both None and NaN representations; all 21 result-set
unit tests and pre-commit checks pass.
--
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]