This is an automated email from the ASF dual-hosted git repository.
tustvold 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 d74051061 Add From<Bytes> for ByteArray (#3720)
d74051061 is described below
commit d74051061a8be0d06b8112901d19d748c7ac0d9f
Author: Raphael Taylor-Davies <[email protected]>
AuthorDate: Tue Feb 14 22:29:43 2023 +0000
Add From<Bytes> for ByteArray (#3720)
* Add From<Bytes> for ByteArray
* Format
---
parquet/src/data_type.rs | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/parquet/src/data_type.rs b/parquet/src/data_type.rs
index 5aff88e53..40d54c78e 100644
--- a/parquet/src/data_type.rs
+++ b/parquet/src/data_type.rs
@@ -17,6 +17,7 @@
//! Data types that connect Parquet physical types with their Rust-specific
//! representations.
+use bytes::Bytes;
use std::cmp::Ordering;
use std::fmt;
use std::mem;
@@ -214,6 +215,12 @@ impl From<ByteBufferPtr> for ByteArray {
}
}
+impl From<Bytes> for ByteArray {
+ fn from(value: Bytes) -> Self {
+ ByteBufferPtr::from(value).into()
+ }
+}
+
impl PartialEq for ByteArray {
fn eq(&self, other: &ByteArray) -> bool {
match (&self.data, &other.data) {