lance
lance copied to clipboard
correctly categorize Error types
as @wjones127 pointed out in #2316, currently our codebase has some errors that are returned as the wrong error type, for example:
return Err(Error::IO {
message: "HashJoiner: No data".to_string(),
location: location!(),
});
has nothing to do with IO
range_to_batches
pub fn range_to_batches(&self, range: Range<usize>) -> Result<Vec<(i32, Range<usize>)>> {
if range.end > *(self.batch_offsets.last().unwrap()) as usize {
return Err(Error::IO {
message: format!(
"Range {:?} is out of bounds {}",
range,
self.batch_offsets.last().unwrap()
),
location: location!(),
});
}
should return a Error::InvalidInput