-
Notifications
You must be signed in to change notification settings - Fork 113
Upgrade the locked data libraries and type-check per interpreter #822
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
b2f0a8c
9af4a07
e3aa3df
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -185,7 +185,6 @@ ignore = [ | |
| ] | ||
|
|
||
| [tool.mypy] | ||
| python_version = "3.10" | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Self-review round 2 (claims, compatibility, operations) — CLEAN. Claims checked: numpy 2.5.3 is resolved only for Python >= 3.12 ( Operational consequence: a local |
||
| follow_imports = "silent" | ||
| disallow_any_generics = true | ||
| strict_optional = true | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -20,6 +20,11 @@ | |
| from tests import ENV | ||
| from tests.pyathena.conftest import connect | ||
|
|
||
| # pandas 3 infers its "str" dtype for strings, which represents NULL as NaN; pandas 2 uses | ||
| # object columns with None. | ||
| STRING_TYPE = pd.Series(["a"]).dtype.type | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Self-review of repair 9af4a07 (rounds 1 and 2, repair scope: Round 1 (behavior): dtype assertions stay exact; only the expected string type and NULL value come from the installed pandas. On pandas 2.3.3 the constants evaluate to Round 2 (claims): the PR body's statements were checked against runs: CSV |
||
| STRING_NULL = pd.Series(["a", None]).iloc[1] | ||
|
|
||
|
|
||
| class TestPandasCursor: | ||
| @pytest.mark.parametrize( | ||
|
|
@@ -641,17 +646,17 @@ def test_complex_as_pandas(self, pandas_cursor, chunksize): | |
| np.int64, | ||
| np.float64, | ||
| np.float64, | ||
| np.object_, | ||
| np.object_, | ||
| STRING_TYPE, | ||
| STRING_TYPE, | ||
| np.datetime64, | ||
| np.object_, | ||
| np.datetime64, | ||
| np.object_, | ||
| STRING_TYPE, | ||
| np.object_, | ||
| STRING_TYPE, | ||
| np.object_, | ||
| np.object_, | ||
| np.object_, | ||
| np.object_, | ||
| STRING_TYPE, | ||
| np.object_, | ||
| ) | ||
| rows = [ | ||
|
|
@@ -763,8 +768,8 @@ def test_complex_unload_as_pandas_pyarrow(self, pandas_cursor, parquet_engine): | |
| np.int64, | ||
| np.float32, | ||
| np.float64, | ||
| np.object_, | ||
| np.object_, | ||
| STRING_TYPE, | ||
| STRING_TYPE, | ||
| np.datetime64, | ||
| np.object_, | ||
| np.object_, | ||
|
|
@@ -1198,7 +1203,7 @@ def test_null_vs_empty_string(self, pandas_cursor, parquet_engine): | |
| # NULL and empty characters are correctly converted when the UNLOAD option is enabled. | ||
| np.testing.assert_equal( | ||
| pandas_cursor.fetchall(), | ||
| [("", "a"), ("N/A", "a"), ("NULL", "a"), (None, "a")], | ||
| [("", "a"), ("N/A", "a"), ("NULL", "a"), (STRING_NULL, "a")], | ||
| ) | ||
| else: | ||
| np.testing.assert_equal( | ||
|
|
@@ -1208,12 +1213,10 @@ def test_null_vs_empty_string(self, pandas_cursor, parquet_engine): | |
| pandas_cursor.execute(query, na_values=None, engine=parquet_engine) | ||
| if pandas_cursor._unload: | ||
| # NULL and empty characters are correctly converted when the UNLOAD option is enabled. | ||
| assert pandas_cursor.fetchall() == [ | ||
| ("", "a"), | ||
| ("N/A", "a"), | ||
| ("NULL", "a"), | ||
| (None, "a"), | ||
| ] | ||
| np.testing.assert_equal( | ||
| pandas_cursor.fetchall(), | ||
| [("", "a"), ("N/A", "a"), ("NULL", "a"), (STRING_NULL, "a")], | ||
| ) | ||
| else: | ||
| assert pandas_cursor.fetchall() == [ | ||
| ("", "a"), | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Independent review (relayed) — reviewer: Codex CLI 0.156.0, model
gpt-6-sol,codex exec --sandbox read-only, session01a0d905-5e80-77b2-9867-1f8077490dbb; static source review (no tests run); base0c26c7ece28b67a06d538e69f9732df3ea1eba42, head9af4a07642e4bc2181fea375fcdc642fab4fe19d; verdict FINDINGS (1). The review snapshot was unchanged afterward.P2 (uv.lock:1256, tests/pyathena/pandas/test_cursor.py:1204 at 9af4a07): "The new lock selects pandas 3 on Python 3.11+, and the revised test accepts
NaNfor a SQL NULL returned byPandasCursorwithunload=True. [...] An existing caller that checkscursor.fetchone()[0] is Nonefor a nullable string will get a false result in the newly locked environment. The documentation still shows that result asNonein docs/null_handling.md:180. Introduced by this diff for locked development and benchmark environments; the pre-existing dependency range already allowed users to install pandas 3 independently. Preserve the tuple API's NULL value or document and test the changed contract."Verified; resolved by documenting in e3aa3df (maintainer decision: follow pandas). Keeping
Nonein PyAthena would need either object conversion of string columns (a copy and a memory regression for large results), a process-wide pandas option inside a thread-pool path, or NaN-to-None mapping that cannot tell NULL from a real double NaN. This table row, the UNLOAD example, and the following text now state the pandas 2 and pandas 3 representations, that the tuple methods return the same values, and two ways to getNone:df.astype({...: object}).where(df.notna(), None)andpd.set_option("future.infer_string", False)(pandas 2.1+). Both were checked against Athena (PandasCursor,unload=True, pandas 3.0.6): defaultstr/nan; converted and opted-out results return(2, None, 'null_value')fromfetchall(). The tests already assert the installed pandas representation.Self-review of the repair (rounds 1 and 2; scope 9af4a07..e3aa3df, docs only): CLEAN.
just docs lintandjust docs buildpass; the CSV rows of the table (NaN for both) and the binary NULL statements are unchanged and still hold on pandas 3. An independent follow-up is pending.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Independent follow-up (relayed) — reviewer: Codex CLI 0.156.0, model
gpt-6-sol,codex exec --sandbox read-only, session01a0d92e-4e60-71f0-adfb-788682133f60; static review of the repair9af4a07..e3aa3dfand the contracts it affects (PandasCursor CSV and Parquet read paths, fetch behavior, pandas cursor tests for pandas 2 and 3). Verdict: CLEAN — "The documented default NULL behavior matches the reviewed paths, and both documented ways to obtainNoneare consistent with them." No tests were run by the reviewer; the snapshot was unchanged afterward.