This is an automated email from the ASF dual-hosted git repository.
alamb pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/arrow-rs.git
The following commit(s) were added to refs/heads/master by this push:
new c7513bd7a96 implement new null for view types (#5894)
c7513bd7a96 is described below
commit c7513bd7a963a6b925e833892869d5fae0db3c62
Author: Xiangpeng Hao <[email protected]>
AuthorDate: Sat Jun 15 13:03:53 2024 -0400
implement new null for view types (#5894)
---
arrow-data/src/data.rs | 17 +++++++++++++++++
1 file changed, 17 insertions(+)
diff --git a/arrow-data/src/data.rs b/arrow-data/src/data.rs
index 12fe4968d5a..b6ff4518e0a 100644
--- a/arrow-data/src/data.rs
+++ b/arrow-data/src/data.rs
@@ -573,6 +573,7 @@ impl ArrayData {
DataType::Binary | DataType::Utf8 => {
(vec![zeroed((len + 1) * 4), zeroed(0)], vec![], true)
}
+ DataType::BinaryView | DataType::Utf8View => (vec![zeroed(len
* 16)], vec![], true),
DataType::LargeBinary | DataType::LargeUtf8 => {
(vec![zeroed((len + 1) * 8), zeroed(0)], vec![], true)
}
@@ -2209,4 +2210,20 @@ mod tests {
data.align_buffers();
data.validate_full().unwrap();
}
+
+ #[test]
+ fn test_null_view_types() {
+ let array_len = 32;
+ let array = ArrayData::new_null(&DataType::BinaryView, array_len);
+ assert_eq!(array.len(), array_len);
+ for i in 0..array.len() {
+ assert!(array.is_null(i));
+ }
+
+ let array = ArrayData::new_null(&DataType::Utf8View, array_len);
+ assert_eq!(array.len(), array_len);
+ for i in 0..array.len() {
+ assert!(array.is_null(i));
+ }
+ }
}