-
Notifications
You must be signed in to change notification settings - Fork 245
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
fix: scan out of range #3339
Conversation
Codecov ReportAttention: Patch coverage is
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
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
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))), | ||
} |
There was a problem hiding this comment.
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
rust/lance-io/src/lib.rs
Outdated
@@ -200,6 +200,18 @@ impl ReadBatchParams { | |||
)), | |||
} | |||
} | |||
|
|||
pub fn to_offsets_total(&self, total: u32) -> Result<PrimitiveArray<UInt32Type>> { |
There was a problem hiding this comment.
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.
rust/lance-io/src/lib.rs
Outdated
Self::Range(r) => Ok(UInt32Array::from(Vec::from_iter( | ||
r.start as u32..r.end as u32, | ||
))), |
There was a problem hiding this comment.
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:
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, | |
)), |
if we scan _rowid or _rowaddr without other columns, an error will come up.