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

fix: scan out of range #3339

Merged
merged 3 commits into from
Jan 10, 2025
Merged

fix: scan out of range #3339

merged 3 commits into from
Jan 10, 2025

Conversation

chenkovsky
Copy link
Contributor

@chenkovsky chenkovsky commented Jan 5, 2025

if we scan _rowid or _rowaddr without other columns, an error will come up.

thread 'tokio-runtime-worker' panicked at rust/lance/src/dataset/[fragment.rs:1986](http://fragment.rs:1986/):18:
called `Result::unwrap()` on an `Err` value: InvalidInput { source: "Cannot slice from 0 with length 333275 given a selection of size 10", location: Location { file: "rust/lance-io/src/[lib.rs](http://lib.rs/)", line: 151, column: 27 } }
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
thread '<unnamed>' panicked at rust/lance/src/io/exec/[scan.rs:236](http://scan.rs:236/):40:
called `Result::unwrap()` on an `Err` value: JoinError::Panic(Id(13), "called `Result::unwrap()` on an `Err` value: InvalidInput { source: \"Cannot slice from 0 with length 333275 given a selection of size 10\", location: Location { file: \"rust/lance-io/src/[lib.rs](http://lib.rs/)\", line: 151, column: 27 } }", ...)
thread '<unnamed>' panicked at core/src/[panicking.rs:221](http://panicking.rs:221/):5:

@github-actions github-actions bot added the bug Something isn't working label Jan 5, 2025
@codecov-commenter
Copy link

codecov-commenter commented Jan 5, 2025

Codecov Report

Attention: Patch coverage is 95.83333% with 3 lines in your changes missing coverage. Please review.

Project coverage is 78.88%. Comparing base (45fde4c) to head (78391a2).
Report is 2 commits behind head on main.

Files with missing lines Patch % Lines
rust/lance-io/src/lib.rs 62.50% 3 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3339      +/-   ##
==========================================
+ Coverage   78.84%   78.88%   +0.04%     
==========================================
  Files         247      247              
  Lines       88281    88388     +107     
  Branches    88281    88388     +107     
==========================================
+ Hits        69603    69724     +121     
+ Misses      15786    15773      -13     
+ Partials     2892     2891       -1     
Flag Coverage Δ
unittests 78.88% <95.83%> (+0.04%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

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

Self::RangeFull => Ok(UInt32Array::from(Vec::from_iter(0_u32..total))),
Self::RangeTo(r) => Ok(UInt32Array::from(Vec::from_iter(0..r.end as u32))),
Self::RangeFrom(r) => Ok(UInt32Array::from(Vec::from_iter(r.start as u32..total))),
}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

maybe we can skip creating vec

@@ -200,6 +200,18 @@ impl ReadBatchParams {
)),
}
}

pub fn to_offsets_total(&self, total: u32) -> Result<PrimitiveArray<UInt32Type>> {
Copy link
Contributor

Choose a reason for hiding this comment

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

Why return result? I don't see any error and you just unwrap() it later anyways.

Comment on lines 207 to 209
Self::Range(r) => Ok(UInt32Array::from(Vec::from_iter(
r.start as u32..r.end as u32,
))),
Copy link
Contributor

Choose a reason for hiding this comment

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

from_iter_values() is what you are looking for:

Suggested change
Self::Range(r) => Ok(UInt32Array::from(Vec::from_iter(
r.start as u32..r.end as u32,
))),
Self::Range(r) => Ok(UInt32Array::from_iter_values(
r.start as u32..r.end as u32,
)),

@wjones127 wjones127 merged commit 29db3bb into lancedb:main Jan 10, 2025
26 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants