Repository navigation
Conversation
`long` is 32-bit on Windows (LLP64), so `readstat_set_row_limit()` and `readstat_set_row_offset()` overflow for files with more than ~2.15 billion rows there. Widen the parser fields and setter arguments to `int64_t`, along with the internal `row_limit`/`row_offset` context fields in the sas7bdat, xport, sav, and por readers (previously `uint32_t`/`int`) so the full range is preserved end-to-end. The Stata reader already used `int64_t`.
|
🤖 Written by AI 🤖 One deliberate scope boundary: the per-row counters that are compared against |
|
Hope to see this merged. Would make it much more comfortable to work with very large SAS datasets, esp. involving sensitive data exclusively accessible on Windows VMs (the use-case/real-world report I posted in the linked issue). |
🤖 Written by AI 🤖
readstat_set_row_limit()andreadstat_set_row_offset()takelong, which is 64-bit on Unix but 32-bit on Windows (LLP64). On Windows, this caps row offsets at ~2.15 billion, which blocks chunked reading of very large files (see tidyverse/haven#194 for a real-world report).This PR widens the row limit/offset to
int64_tthroughout:readstat_parser_tfields and the two setter signatures inreadstat.h/readstat_parser.cuint32_t), xport (int), sav (int), and por (int) readers, so the full range survives the handoff from parser to readerrow_limit(int kcould overflow for limits aboveINT_MAX)snprintfformat updated toPRId64accordinglyThe Stata reader already used
int64_tfor these fields, so this also makes the readers consistent.Note this changes the public API signatures of the two setters. On Windows, callers passing
longwill still compile (implicit widening), but the ABI changes.make checkpasses (4/4, including thetest_readstatcorpus suite).