Repository navigation
BUG: read_sql with integer dtype rounds large ints through float64 (GH#61667) - #71504
Open
jbrockmendel wants to merge 2 commits into
Open
jbrockmendel wants to merge 2 commits into
jbrockmendel wants to merge 2 commits into
Conversation
jbrockmendel
marked this pull request as ready for review
October 24, 2026 17:19
jbrockmendel
force-pushed
the
bug-61667
branch
2 times, most recently
from
November 1, 2026 20:54
048eec3 to
75e742f
Compare
…H#61667) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…al Decimals Only Decimal and int+NULL columns lose precision through inference, so only those skip it; other int columns keep main's casting behavior. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
jbrockmendel
force-pushed
the
bug-61667
branch
from
November 9, 2026 03:02
14126f2 to
d3c9813
Compare
This branch has not been deployed
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.
closes #61667
read_sql/read_sql_queryinfer each column first and applydtype=afterwards, so aDecimalcolumn (under the defaultcoerce_float=True) or an integer column containingNULLpasses through float64 and loses values beyond2**53before an integerdtypeever sees them. Now a column requested as an integer dtype (int64,uint64,Int64,int64[pyarrow], ...) whose values are ints/Decimals is cast directly from the exact values. All other targets keep the existing inference, and a numpy int dtype on a column withNULLstill raisesIntCastingNaNErroras before.This leaves the default
coerce_floatbehavior alone (GH-63532); thecoerce_floatdocstring note added in GH-66655 now points to an integerdtypeas the way to keep such values exact. The ADBC driver path converts to float64 before pandas sees the data and is not changed here (the new test xfails it).AI disclosure: drafted with Claude Code (
claude opus 5.5 (high)), used to investigate, write the fix and tests, and review the branch.