bito-code-review[bot] commented on code in PR #44743:
URL: https://github.com/apache/superset/pull/44743#discussion_r4120020725


##########
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:
   <!-- Bito Reply -->
   The suggestion is correct. In the specified environment, `to_pandas_df` 
converts null values in string columns to `nan` rather than `None`. Using 
`pd.isna` is the appropriate way to assert the presence of a null value in this 
context.
   
   **tests/unit_tests/result_set_test.py**
   ```
   assert df["id"].tolist() == [1, 2, 3]
       assert df["ubig"].tolist() == ["18446744073709551615", "0", None]
   ```



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