python: prefer pyarrow when we can memory map the file #4182
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.
This change prefers the pyarrow reader because we can memory map the file. This will only trigger an IO read syscall when we actually read the colums, and only the parts that we read.
In lazy we can do projection/predicate pushdown on the memory mapped columns. The columns that will be filtered out never trigger a read call.
Another advantage is that we might be able to work on larger than memory data as the OS will purge pages back that are not used when it needs more RAM.
If the files do easily fit in RAM, we can query from the file system. Subsequent queries on a file may be much faster as the file/or large parts of it can still be in RAM.
I have some ideas for being able to do this natively as well. Might follow up on that.