You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@arrow.apache.org by uw...@apache.org on 2018/10/31 12:26:09 UTC
[arrow] branch master updated: ARROW-3658: [Rust] Incorrect
`List` tests
This is an automated email from the ASF dual-hosted git repository.
uwe 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 4ef1dac ARROW-3658: [Rust] Incorrect `List<T>` tests
4ef1dac is described below
commit 4ef1dacb477d3539e274317b0a49159fe6550bbd
Author: Paddy Horan <pa...@hotmail.com>
AuthorDate: Wed Oct 31 13:25:56 2018 +0100
ARROW-3658: [Rust] Incorrect `List<T>` tests
Author: Paddy Horan <pa...@hotmail.com>
Closes #2877 from paddyhoran/ARROW-3658 and squashes the following commits:
ab615192 <Paddy Horan> Fixed `List<T>` tests
c7db6f30 <Paddy Horan> Fixed offset validation of `List<T>` and tests
---
rust/src/array.rs | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)
diff --git a/rust/src/array.rs b/rust/src/array.rs
index 963a235..0ee792c 100644
--- a/rust/src/array.rs
+++ b/rust/src/array.rs
@@ -813,13 +813,13 @@ mod tests {
fn test_list_array() {
// Construct a value array
let value_data = ArrayData::builder(DataType::Int32)
- .len(7)
+ .len(8)
.add_buffer(Buffer::from(&[0, 1, 2, 3, 4, 5, 6, 7].to_byte_slice()))
.build();
// Construct a buffer for value offsets, for the nested array:
// [[0, 1, 2], [3, 4, 5], [6, 7]]
- let value_offsets = Buffer::from(&[0, 2, 5, 7].to_byte_slice());
+ let value_offsets = Buffer::from(&[0, 3, 6, 8].to_byte_slice());
// Construct a list array from the above two
let list_data_type = DataType::List(Box::new(DataType::Int32));
@@ -835,7 +835,7 @@ mod tests {
assert_eq!(DataType::Int32, list_array.value_type());
assert_eq!(3, list_array.len());
assert_eq!(0, list_array.null_count());
- assert_eq!(5, list_array.value_offset(2));
+ assert_eq!(6, list_array.value_offset(2));
assert_eq!(2, list_array.value_length(2));
for i in 0..3 {
assert!(list_array.is_valid(i as i64));
@@ -856,7 +856,7 @@ mod tests {
assert_eq!(DataType::Int32, list_array.value_type());
assert_eq!(3, list_array.len());
assert_eq!(0, list_array.null_count());
- assert_eq!(5, list_array.value_offset(1));
+ assert_eq!(6, list_array.value_offset(1));
assert_eq!(2, list_array.value_length(1));
}
@@ -864,7 +864,7 @@ mod tests {
#[should_panic(expected = "ListArray data should contain a single buffer only (value offsets)")]
fn test_list_array_invalid_buffer_len() {
let value_data = ArrayData::builder(DataType::Int32)
- .len(7)
+ .len(8)
.add_buffer(Buffer::from(&[0, 1, 2, 3, 4, 5, 6, 7].to_byte_slice()))
.build();
let list_data_type = DataType::List(Box::new(DataType::Int32));
@@ -891,7 +891,7 @@ mod tests {
#[should_panic(expected = "offsets do not start at zero")]
fn test_list_array_invalid_value_offset_start() {
let value_data = ArrayData::builder(DataType::Int32)
- .len(7)
+ .len(8)
.add_buffer(Buffer::from(&[0, 1, 2, 3, 4, 5, 6, 7].to_byte_slice()))
.build();
@@ -910,11 +910,11 @@ mod tests {
#[should_panic(expected = "inconsistent offsets buffer and values array")]
fn test_list_array_invalid_value_offset_end() {
let value_data = ArrayData::builder(DataType::Int32)
- .len(7)
+ .len(8)
.add_buffer(Buffer::from(&[0, 1, 2, 3, 4, 5, 6, 7].to_byte_slice()))
.build();
- let value_offsets = Buffer::from(&[0, 2, 5, 8].to_byte_slice());
+ let value_offsets = Buffer::from(&[0, 2, 5, 7].to_byte_slice());
let list_data_type = DataType::List(Box::new(DataType::Int32));
let list_data = ArrayData::builder(list_data_type.clone())