ARROW-9458: [Python] Release GIL in ScanTask.execute#7756
Closed
maartenbreddels wants to merge 2 commits into
Closed
ARROW-9458: [Python] Release GIL in ScanTask.execute#7756maartenbreddels wants to merge 2 commits into
maartenbreddels wants to merge 2 commits into
Conversation
Co-authored-by: Joris Van den Bossche <jorisvandenbossche@gmail.com>
Member
|
Thanks for the PR! (OK, I was missing the (no worries about the authorship, I have my commits in arrow ;)) |
Member
|
And I can confirm using scan tasks now gives a similar parallelization speed up as using fragments. |
jorisvandenbossche
approved these changes
Jul 14, 2020
Contributor
Author
|
FYI, this: ## common code ##
import pyarrow as pa
import pyarrow.dataset as ds
import concurrent.futures
import glob
pool = concurrent.futures.ThreadPoolExecutor()
ds = pa.dataset.dataset(glob.glob('/data/taxi_parquet/data_*.parquet'))
## end common code ##
def process(f):
scan_count = 0
return len(f.to_table(use_threads=False))
sum(pool.map(process, ds.get_fragments()))For me takes between 10 and 16 second (very irregular) While this: def process(fragment):
scanned = 0
for scan_task in fragment.scan(use_threads=False):
for record_batch in scan_task.execute():
scanned += record_batch.num_rows
return scanned
sum(pool.map(process, ds.get_fragments()))takes 7-9 seconds, more consistently. Each file (fragment) has 1 million rows (1 rowgroup). Could be uninteresting details, but I though I'd share it. |
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.
@jorisvandenbossche FYI I made you coauthor