Repository navigation
Fix integer overflow in geographic distance features - #1099
Open
aalquwayfili wants to merge 1 commit into
Open
aalquwayfili wants to merge 1 commit into
aalquwayfili wants to merge 1 commit into
Conversation
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.
GeoDistanceFeaturescan produce incorrect Euclidean and Manhattan distances when coordinate columns use narrow or unsigned integer dtypes. For example, the validuint8coordinates(1, 2)and(0, 1)produce approximately 40,029 km instead of 157 km with the Euclidean method. Signed integer overflow can also produce a negative Manhattan distance.Compute coordinate differences in floating point before subtraction, so neither the differences nor their Manhattan sum overflow. The regression covers unsigned subtraction, signed subtraction, signed addition, both route directions, and a floating-point control; the original coordinate columns retain their dtypes and values.
Validation: all 192 creation tests pass, including the 8 regression cases and the existing pipeline checks. Targeted Flake8, mypy, and isort checks pass.
The subtraction now computes in float64. The full-project mypy check reports two errors in unrelated files; its output is identical on the unmodified base. Repository-wide tests and documentation rendering were not run.
Upstream CI: all Python 3.10–3.14 test configurations, documentation, style and typing pass. The Python 3.9 job has the same 52 failing estimator-check IDs and exception summaries as the exact unmodified base; its passed-test count increases from 2,065 to 2,073 with the eight new cases.