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

[FEAT] Monotonically Increasing Id for Swordfish #3180

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

colin-ho
Copy link
Contributor

@colin-ho colin-ho commented Nov 5, 2024

Implements monotonically increasing id as a streaming sink with max_concurrency = 1.

I tested multithreaded and single threaded implementations and found that there was no performance gain in multithreaded. This is because monotonically increasing id is a memory bound operator, all it does is allocate an array of ints for the id. Multiple threads trying to do this in parallel are bottlenecked by memory bandwidth.

It is actually also much simpler to implement this as a single threaded operation, as we just need to keep a running count of the lengths of morsels seen so far. This is effectively just row_number.

Note:

  • There was a bug in the pyfunc_into_table_iter function, which consumes python iterators in scan tasks (used in read_lance and read_generator), where the consumer only calls next() on the iterator once. This PR fixes that.

@github-actions github-actions bot added the enhancement New feature or request label Nov 5, 2024
Copy link

codspeed-hq bot commented Nov 5, 2024

CodSpeed Performance Report

Merging #3180 will improve performances by ×2.2

Comparing colin/swordfish-mono-id (509e645) with main (84db665)

Summary

⚡ 2 improvements
✅ 15 untouched benchmarks

Benchmarks breakdown

Benchmark main colin/swordfish-mono-id Change
test_iter_rows_first_row[100 Small Files] 421.4 ms 375 ms +12.36%
test_show[100 Small Files] 32.7 ms 14.9 ms ×2.2

Copy link

codecov bot commented Nov 5, 2024

Codecov Report

Attention: Patch coverage is 84.84848% with 20 lines in your changes missing coverage. Please review.

Project coverage is 74.96%. Comparing base (84db665) to head (509e645).

Files with missing lines Patch % Lines
...execution/src/sinks/monotonically_increasing_id.rs 77.01% 20 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #3180      +/-   ##
==========================================
- Coverage   77.55%   74.96%   -2.60%     
==========================================
  Files         668      669       +1     
  Lines       82268    86911    +4643     
==========================================
+ Hits        63807    65151    +1344     
- Misses      18461    21760    +3299     
Files with missing lines Coverage Δ
src/daft-local-execution/src/pipeline.rs 95.51% <100.00%> (+0.09%) ⬆️
src/daft-local-plan/src/plan.rs 96.72% <100.00%> (+0.14%) ⬆️
src/daft-local-plan/src/translate.rs 94.15% <100.00%> (+0.24%) ⬆️
src/daft-micropartition/src/python.rs 78.32% <100.00%> (+0.04%) ⬆️
...execution/src/sinks/monotonically_increasing_id.rs 41.10% <77.01%> (ø)

... and 39 files with indirect coverage changes

@colin-ho colin-ho changed the base branch from main to colin/probe-state-bridge November 15, 2024 15:47
@colin-ho colin-ho changed the base branch from colin/probe-state-bridge to main November 15, 2024 16:31
@colin-ho colin-ho marked this pull request as ready for review November 15, 2024 16:52
@colin-ho colin-ho requested review from samster25 and jaychia and removed request for samster25 November 15, 2024 23:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant