Repository navigation
Fix wrong values and lost parallelism in the pandas, numpy and Arrow input scans - #700
Merged
evertlammerts merged 18 commits intoOct 20, 2026
Merged
Conversation
evertlammerts
force-pushed
the
input-scan-fixes
branch
from
October 20, 2026 07:58
54ef677 to
41c5e5c
Compare
evertlammerts
enabled auto-merge
October 20, 2026 08:18
evertlammerts
force-pushed
the
input-scan-fixes
branch
from
October 20, 2026 09:37
41c5e5c to
dd2a3e9
Compare
evertlammerts
added a commit
that referenced
this pull request
Oct 20, 2026
Fixes the cp311 Windows wheel job of the Release workflow, which fails every run since #700 in `test_a_dictionary_is_decoded_once_per_large_batch` before any DuckDB code runs: pyarrow.lib.ArrowIndexError: Index -1074 out of bounds The test builds its dictionary indices as `np.arange(2_000_000) * 1_000_000 // 2_000_000`. On Windows with numpy below 2, `np.arange` defaults to int32 (the C `long`), so the product overflows and about half the indices come out negative. The cp311 job is the only Windows job that installs numpy below 2 (the tensorflow pin), which is why neither the PR workflow nor the other wheel jobs saw it. An int32 simulation gives the same minimum of -1074. The arange now carries `dtype=np.int64`. Same class as #696; the other `np.arange` calls in the tests are small, float, or typed.
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.
Input scan fixes for pandas, numpy and Arrow, found by comparing the 2.0 client with neo.
This PR makes duckdb read each pandas or numpy column as the array it holds at bind: its buffer, length, dtype and mask. Some fixes change behavior.
Currently:
With this PR, bind reads each column once and checks it against one row count:
Column 'b' has 2 rows where 'a' has 5. Masked elements read NULL, count(*) reads no column, pyarrow strings are read as Arrow without the GIL, and the Arrow scan splits batches into 122880 row ranges, so one chunk uses every thread. Unordered results from such a source can now vary.Benchmarks (instructions): suite geomean 0.69x, 0 slower; a 2M row str column 0.30x; count(*) over a str frame 0.01x. A 10 percent masked array costs 1.63x: the base ignored masks.
Notes:
Next PR:
con.appendand Spark, so it waits for the relational API rework.