Repository navigation
[Python] Support pandas 3 in tests and allow pandas<4 - #1030
Merged
Merged
Conversation
PatrickJin-db
requested review from
chakankardb,
linzhou-db,
littlegrasscao,
mengxi-chen88 and
wchau
as code owners
November 6, 2026 22:02
linzhou-db
previously approved these changes
Nov 6, 2026
Fixes delta-io#916. pandas 3 changes several defaults that the Python tests relied on: - pd.Timestamp literals are inferred at microsecond resolution, while the legacy reader returns the nanosecond resolution of the INT96 timestamps in the test parquet files. - String data defaults to the `str` dtype instead of `object`, both for literals in test expectations and for pyarrow's Table.to_pandas(). - None and NaN no longer compare equal in assert_frame_equal when an object column is compared against a float column. - pd.concat no longer ignores all-NA object placeholder columns, so columns missing from older files (added with `pdf[col] = None`) come back as object instead of float. Pandas dtypes are best effort: neither the docs nor the docstrings promise them, and the add-column tests already used check_dtype=False. The tests now compare pandas results with that leniency (nulls normalized), while Arrow schema assertions stay strict because Arrow types follow the Delta schema. The library code is unchanged. Raise the pandas bound to <4.0.0 and update the matching requires-dist specifier in uv.lock. The locked pandas stays 2.3.3, so CI keeps testing pandas 2 only. Signed-off-by: Patrick Jin <patrick.jin@databricks.com> Co-authored-by: Isaac <no-reply@databricks.com>
uv.lock pins pandas 2.3.3, so CI only exercised pandas 2 even though pyproject.toml now allows pandas<4. Add a Python 3.11 job that installs the latest pandas 3 on top of the locked environment, keeping the existing locked jobs. UV_NO_SYNC stops `uv run` from reinstalling the locked pandas before the tests run. Co-authored-by: Isaac <no-reply@databricks.com> Signed-off-by: Patrick Jin <patrick.jin@databricks.com>
Re-resolve pandas in uv.lock (`uv lock --upgrade-package pandas`) now that the pandas bound allows 3.x. pandas 3 requires Python >= 3.11, so the lock forks: pandas 3.0.6 for Python >= 3.11 and pandas 2.3.3 for Python 3.10. Only pandas changes. pandas 3 declares tzdata only for win32/emscripten and drops the pytz dependency, which splits the resolution markers by sys_platform. numpy and every other locked version are unchanged. Signed-off-by: Patrick Jin <patrick.jin@databricks.com> Co-authored-by: Isaac <no-reply@databricks.com>
This reverts commit 065a8ee. uv.lock now provides pandas 3 for Python 3.11+ and pandas 2.3.3 for Python 3.10, so the existing 3.10 and 3.11 matrix jobs test pandas 2 and pandas 3 without the extra matrix entry, pandas install step, or UV_NO_SYNC override. Signed-off-by: Patrick Jin <patrick.jin@databricks.com> Co-authored-by: Isaac <no-reply@databricks.com>
PatrickJin-db
force-pushed
the
fix-issue-916
branch
from
November 9, 2026 22:23
f896729 to
c8e20a6
Compare
linzhou-db
approved these changes
Nov 10, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #916.
Why
pandas 3 changed several defaults, and the Python tests were written against the pandas 2 ones:
pd.Timestampliterals now default to microsecond resolution. The legacy reader returns the nanosecond resolution of the INT96 timestamps stored in the test parquet files.strdtype instead ofobject. This applies both to test expectations and to pyarrow'sTable.to_pandas().assert_frame_equalno longer treatsNoneandNaNas equal when it compares anobjectcolumn with a float column.concat:pd.concatno longer ignores all-NAobjectplaceholder columns. Columns that older files don't have (added withpdf[col] = None) now come back asobjectinstead of float.Pandas dtypes are best effort. The docs and docstrings make no promise about them, and the add-column tests already used
check_dtype=False. So this PR compares pandas results with the same leniency, after making nulls comparable. Arrow schema assertions stay strict, because Arrow types follow the Delta schema. Library code is unchanged.The pandas bound goes up to
<4.0.0, and the matchingrequires-distspecifier inuv.lockis updated to match.uv.lockis re-resolved so that pandas 3.0.6 is locked for Python >= 3.11 (pandas 3 requires it) and pandas 2.3.3 for Python 3.10. No other package version changes.Test plan
Ran the full Python suite, including integration tests against a local
TestDeltaSharingServer:216 passed, 1 skippeduv export --frozen):216 passed, 1 skipped(before this change:26 failed, 190 passed, 1 skipped)black --line-length 100 --check delta_sharing/tests/: cleanuv lock --check --offline: passesThe existing CI matrix covers both versions through the lock: the Python 3.10 job tests pandas 2.3.3 and the Python 3.11 job tests pandas 3.0.6, with no workflow changes.
This pull request and its description were written by Isaac.