Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: Remove spawn and channel inside arrow reader #806

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

Xuanwo
Copy link
Member

@Xuanwo Xuanwo commented Dec 16, 2024

This PR will remove spwan and channel inside arrow reader so users can concurrently read data stream without extra cost.

@Xuanwo
Copy link
Member Author

Xuanwo commented Dec 16, 2024

Also cc @sdd for a look, thank you!

@sdd
Copy link
Contributor

sdd commented Dec 20, 2024

I'm not sure this is what we want. try_buffer_unordered executes futures concurrently according to the docs: https://docs.rs/futures/latest/futures/stream/trait.TryStreamExt.html#method.try_buffer_unordered

This does not necessarily mean in parallel, which is what we want. I encountered a similar thing when we were originally using try_for_each_concurrent here. As per the note in the second paragraph of the docs here, no threads are introduced. The executor switches between each future on a single thread. We're CPU bound in the reader rather than IO-bound like in the planning phase, and so we want true parallelism.

The double-spawn approach is not as neat but it ensures parallelism.

@Xuanwo
Copy link
Member Author

Xuanwo commented Dec 20, 2024

I'm not sure this is what we want. try_buffer_unordered executes futures concurrently according to the docs: docs.rs/futures/latest/futures/stream/trait.TryStreamExt.html#method.try_buffer_unordered

Hi, try_buffer_unordered does execute concurrently that multiple futures are been polled at the same time by multiple async runtime worker threads.

My ultimate goal is to eliminate concurrency_limit_data_files from our reading process and handle only FileScanTasks to create a Stream<Item=RecordBatch>. This approach will allow users to utilize our APIs to implement various reading strategies.

Our current implementation prevents the query engine from adopting Push-Based Execution, which should have control over the underlying I/O and CPU operations.

See also apache/arrow-rs#6907

@sdd
Copy link
Contributor

sdd commented Dec 20, 2024

Hi, try_buffer_unordered does execute concurrently that multiple futures are been polled at the same time by multiple async runtime worker threads.

In that case, great - try_buffer_unordered is much neater.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants