You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@arrow.apache.org by we...@apache.org on 2018/11/15 14:40:35 UTC
[arrow] branch master updated: ARROW-3797: [Rust]
BinaryArray::value_offset incorrect in offset case
This is an automated email from the ASF dual-hosted git repository.
wesm pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/arrow.git
The following commit(s) were added to refs/heads/master by this push:
new 1a00fe5 ARROW-3797: [Rust] BinaryArray::value_offset incorrect in offset case
1a00fe5 is described below
commit 1a00fe5385efbd63ae77f71c63dc101e6cbd26d2
Author: Brent Kerby <bl...@gmail.com>
AuthorDate: Thu Nov 15 09:40:17 2018 -0500
ARROW-3797: [Rust] BinaryArray::value_offset incorrect in offset case
Fixes a bug in BinaryArray::value_offset. Also added test cases to now cover this method as well as the BinaryArray::value_length method in the case where the underlying ArrayData has a nonzero offset.
Author: Brent Kerby <bl...@gmail.com>
Closes #2971 from blkerby/BinaryArray_offset_fix and squashes the following commits:
fea0730cf <Brent Kerby> Fix argument order in assert_eq in new test cases
8193a265d <Brent Kerby> Add test for BinaryArray::value_offset and value_length for offset case
31cc4527e <Brent Kerby> Fix bug in BinaryArray::value_offset
---
rust/src/array.rs | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/rust/src/array.rs b/rust/src/array.rs
index 0144c64..9157897 100644
--- a/rust/src/array.rs
+++ b/rust/src/array.rs
@@ -526,7 +526,7 @@ impl BinaryArray {
/// Note this doesn't do any bound checking, for performance reason.
#[inline]
pub fn value_offset(&self, i: i64) -> i32 {
- self.value_offset_at(i)
+ self.value_offset_at(self.data.offset() + i)
}
/// Returns the length for the element at index `i`.
@@ -981,6 +981,10 @@ mod tests {
binary_array.get_value(1)
);
assert_eq!("parquet", binary_array.get_string(1));
+ assert_eq!(5, binary_array.value_offset(0));
+ assert_eq!(0, binary_array.value_length(0));
+ assert_eq!(5, binary_array.value_offset(1));
+ assert_eq!(7, binary_array.value_length(1));
}
#[test]