Skip to content

Conversation

nameexhaustion
Copy link
Collaborator

Return empty Bytes object if the range is empty. I've also opened an issue upstream at apache/arrow-rs-object-store#453.

Note that I cannot reproduce the Python MRE in the issue, but I've tested this in the Rust side:

---- cloud::polars_object_store::tests::test_ stdout ----
[crates/polars-io/src/cloud/polars_object_store.rs:552:13] store.1.get_range(&object_path_from_str("iris.parquet").unwrap(), 0..0).await = Ok(
    b"",
)
[crates/polars-io/src/cloud/polars_object_store.rs:559:13] store.1.get_range(&object_path_from_str("iris.parquet").unwrap(), i32::MAX as usize..i32::MAX as usize).await = Ok(
    b"",
)
[crates/polars-io/src/cloud/polars_object_store.rs:566:13] store.1.get_ranges_sort(&object_path_from_str("iris.parquet").unwrap(), &mut
[0..0, 0..0]).await = Ok(
    {
        0: MemSlice {
            slice: [],
            inner: Bytes(
                b"",
            ),
        },
    },
)

@github-actions github-actions bot added fix Bug fix python Related to Python Polars rust Related to Rust Polars labels Jul 31, 2025
Copy link

codecov bot commented Jul 31, 2025

Codecov Report

❌ Patch coverage is 66.66667% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 81.39%. Comparing base (4b0f8dd) to head (b467f5a).
⚠️ Report is 3 commits behind head on main.

Files with missing lines Patch % Lines
crates/polars-io/src/cloud/polars_object_store.rs 66.66% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #23844      +/-   ##
==========================================
+ Coverage   81.38%   81.39%   +0.01%     
==========================================
  Files        1653     1653              
  Lines      224519   224525       +6     
  Branches     2873     2873              
==========================================
+ Hits       182718   182761      +43     
+ Misses      41087    41050      -37     
  Partials      714      714              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@nameexhaustion nameexhaustion marked this pull request as ready for review July 31, 2025 15:12
@ritchie46 ritchie46 merged commit 840a8ac into pola-rs:main Jul 31, 2025
24 checks passed
@@ -154,6 +154,10 @@ impl PolarsObjectStore {
+ TryStreamExt<Ok = Bytes, Error = PolarsError, Item = PolarsResult<Bytes>>
+ use<'a, T> {
futures::stream::iter(ranges.map(move |range| async move {
if range.is_empty() {
return Ok(Bytes::new());

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be returning an empty range even if the file doesn't exist?

Copy link
Collaborator Author

@nameexhaustion nameexhaustion Jul 31, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be returning an empty range even if the file doesn't exist?

For our use case, it's not really a concern if the file doesn't actually exist. That being said, the approach we've taken here might not necessarily be a suitable default for the object store library itself.

Washiil pushed a commit to Washiil/polars that referenced this pull request Jul 31, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
fix Bug fix python Related to Python Polars rust Related to Rust Polars
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Generic S3 error raised when reading parquet file from S3 with DELTA_BINARY_PACKED encoding
3 participants