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] migrate schema inference → async, block at py boundary #3432

Merged
merged 2 commits into from
Nov 27, 2024

Conversation

andrewgazelka
Copy link
Contributor

@andrewgazelka andrewgazelka commented Nov 26, 2024

Converts schema inference operations for CSV, JSON, and Parquet files to use async/await instead of synchronous runtime blocking. This architectural change ensures that blocking operations happen at the highest level possible (the Python API boundary) rather than deep within the inference logic. Key changes include:

  • Making read_csv_schema, read_json_schema, and read_parquet_schema async
  • Updating scan builder interfaces to use async finish() methods
  • Removing unnecessary runtime.block_on calls from schema inference paths
  • Moving runtime.block_on calls to Python API layer where blocking is unavoidable
  • Converting schema-related tests to use tokio async runtime
  • Adding common-runtime dependency where needed
  • Fixes refactor: GlobScanOperator do not block runtime! #3423

This change improves the consistency of async IO handling and creates a cleaner architecture where blocking is consolidated at the Python interface rather than scattered throughout the codebase.

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

This stack of pull requests is managed by Graphite. Learn more about stacking.

@universalmind303 universalmind303 removed their request for review November 26, 2024 16:51
@andrewgazelka andrewgazelka force-pushed the andrew/async-glob branch 6 times, most recently from be39505 to ec9e285 Compare November 26, 2024 22:31
Copy link

codspeed-hq bot commented Nov 26, 2024

CodSpeed Performance Report

Merging #3432 will degrade performances by 42.44%

Comparing andrew/async-glob (f23654a) with main (2db1233)

Summary

❌ 1 regressions
✅ 16 untouched benchmarks

⚠️ Please fix the performance issues or acknowledge them on CodSpeed.

Benchmarks breakdown

Benchmark main andrew/async-glob Change
test_show[100 Small Files] 23.2 ms 40.4 ms -42.44%

@andrewgazelka andrewgazelka force-pushed the andrew/async-glob branch 3 times, most recently from f71c980 to 1429f0f Compare November 26, 2024 23:11
@andrewgazelka andrewgazelka marked this pull request as ready for review November 26, 2024 23:29
@andrewgazelka andrewgazelka changed the title [FEAT] add async glob [FEAT] migrate schema inference → async, block at py boundary Nov 26, 2024
Copy link

codecov bot commented Nov 26, 2024

Codecov Report

Attention: Patch coverage is 85.22727% with 26 lines in your changes missing coverage. Please review.

Project coverage is 77.36%. Comparing base (2db1233) to head (f23654a).
Report is 2 commits behind head on main.

Files with missing lines Patch % Lines
src/daft-csv/src/metadata.rs 58.62% 24 Missing ⚠️
src/daft-scan/src/glob.rs 91.66% 2 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #3432      +/-   ##
==========================================
+ Coverage   77.35%   77.36%   +0.01%     
==========================================
  Files         684      684              
  Lines       83637    83692      +55     
==========================================
+ Hits        64695    64751      +56     
+ Misses      18942    18941       -1     
Files with missing lines Coverage Δ
src/daft-csv/src/python.rs 50.00% <100.00%> (+3.70%) ⬆️
src/daft-json/src/python.rs 49.15% <100.00%> (+3.69%) ⬆️
src/daft-json/src/schema.rs 75.94% <100.00%> (+0.70%) ⬆️
src/daft-parquet/src/python.rs 59.84% <100.00%> (+0.93%) ⬆️
src/daft-parquet/src/read.rs 75.29% <100.00%> (-0.05%) ⬇️
src/daft-scan/src/builder.rs 21.12% <100.00%> (+1.38%) ⬆️
src/daft-scan/src/lib.rs 60.34% <100.00%> (+0.06%) ⬆️
src/daft-scan/src/python.rs 77.04% <100.00%> (+0.31%) ⬆️
src/daft-sql/src/table_provider/read_csv.rs 91.25% <100.00%> (+0.22%) ⬆️
src/daft-sql/src/table_provider/read_parquet.rs 96.66% <100.00%> (+0.11%) ⬆️
... and 2 more

... and 2 files with indirect coverage changes

@andrewgazelka andrewgazelka removed the request for review from universalmind303 November 27, 2024 01:20
src/daft-csv/src/python.rs Outdated Show resolved Hide resolved
src/daft-parquet/src/python.rs Outdated Show resolved Hide resolved
src/daft-scan/src/glob.rs Outdated Show resolved Hide resolved
src/daft-scan/src/glob.rs Outdated Show resolved Hide resolved
src/daft-scan/src/glob.rs Outdated Show resolved Hide resolved
@andrewgazelka andrewgazelka force-pushed the andrew/async-glob branch 2 times, most recently from 9806a0b to e65c236 Compare November 27, 2024 05:25
@andrewgazelka andrewgazelka enabled auto-merge (squash) November 27, 2024 06:02
@andrewgazelka andrewgazelka merged commit b6eee0b into main Nov 27, 2024
42 of 43 checks passed
@andrewgazelka andrewgazelka deleted the andrew/async-glob branch November 27, 2024 06:10
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.

refactor: GlobScanOperator do not block runtime!
3 participants