Skip to content
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

BUG: integer overflow when reading int64 column #259

Closed
theroggy opened this issue Aug 9, 2023 · 0 comments · Fixed by #260
Closed

BUG: integer overflow when reading int64 column #259

theroggy opened this issue Aug 9, 2023 · 0 comments · Fixed by #260
Assignees

Comments

@theroggy
Copy link
Member

theroggy commented Aug 9, 2023

When reading a .gpkg file with an integer column with values > the max 32 bit int value (2.147.483.647), those values overflow to negative values when read.

The use_arrow=True code path doesn't have this issue.

Code to reproduce behaviour

from pathlib import Path

import geopandas as gpd
import pyogrio
import shapely


script_dir = Path(__file__).resolve().parent
path = script_dir / "int_overflow_tmp.gpkg"
gdf = gpd.GeoDataFrame(
    data={"overflowing_int": [2192502720]}, geometry=[shapely.Point(0,1)], crs="epsg:31370"
)
pyogrio.write_dataframe(gdf, path)

gdf = pyogrio.read_dataframe(path, use_arrow=False)
print(f"with use_arrow=False:\n{gdf}")
gdf = pyogrio.read_dataframe(path, use_arrow=True)
print(f"with use_arrow=True:\n{gdf}")
@theroggy theroggy self-assigned this Aug 9, 2023
@theroggy theroggy changed the title BUG: integer overflow when reading .gpkg BUG: integer overflow when reading int64 column Aug 9, 2023
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant