Latest Results
fix(sql): reject negative literals for unsigned table function options (#7479)
## Changes Made
Negative literals for unsigned table function options wrapped around
instead of erroring:
```python
daft.sql("SELECT * FROM read_parquet('f.parquet', chunk_size => -1)") # accepted silently
daft.sql("SELECT * FROM read_iceberg('...', snapshot_id => -1)")
# ValueError: Snapshot not found: 18446744073709551615
```
`impl SQLLiteral for usize` used `lit.as_i64().map(|v| v as usize)`, a
wrapping cast. It now
delegates to `daft_core::lit::Literal::try_as_usize`, the crate's
existing policy, which also
accepts integer widths `as_i64` rejected outright. The message stays
ours, since the core
error mentions `usize`.
Scope is the options actually parsed as `usize` β `chunk_size`,
`buffer_size`, `snapshot_id`,
and the `HTTPConfig`/`TosConfig` numerics. `S3Config` and `AzureConfig`
read theirs as `i64`
and cast to `u32`, so those still wrap; that is a separate fix.
## Testing
Parametrized rejection of negative `chunk_size`/`buffer_size` across
`read_parquet`,
`read_csv` and `read_json` β all five fail on `main`. native `tests/sql`
412 passed, ray 29,
`make precommit` clean.
## AI usage disclosure
Written with an AI coding assistant. I reviewed the full diff,
reproduced the wraparound on an
unpatched build, and reverted the fix to confirm the new tests fail
without it.
## Related Issues
Closes #7478. Split out of #7354; the `snapshot_id` typing is #7477.
Co-authored-by: Srinivas Lade <srinulade1@gmail.com> Latest Branches
0%
rohankumardubey:feature/webdataset-reader 0%
jonasdedden:fix/7471-regexp-replace-backslash 0%
jonasdedden:fix-to-datetime-all-null-offset Β© 2026 CodSpeed Technology