From 92fcaef12dcf3391319c0049e138aa9d6fb4a044 Mon Sep 17 00:00:00 2001 From: Raphael Taylor-Davies Date: Tue, 14 Feb 2023 21:47:41 +0000 Subject: [PATCH 1/2] Add From for ByteArray --- 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 5aff88e53402..e529d0e99d75 100644 --- a/parquet/src/data_type.rs +++ b/parquet/src/data_type.rs @@ -22,6 +22,7 @@ use std::fmt; use std::mem; use std::ops::{Deref, DerefMut}; use std::str::from_utf8; +use bytes::Bytes; use crate::basic::Type; use crate::column::reader::{ColumnReader, ColumnReaderImpl}; @@ -214,6 +215,12 @@ impl From for ByteArray { } } +impl From 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) { From ea03175c1c364c934ff1e6d082b41b9405a09165 Mon Sep 17 00:00:00 2001 From: Raphael Taylor-Davies Date: Tue, 14 Feb 2023 22:05:24 +0000 Subject: [PATCH 2/2] Format --- parquet/src/data_type.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/parquet/src/data_type.rs b/parquet/src/data_type.rs index e529d0e99d75..40d54c78ed1d 100644 --- a/parquet/src/data_type.rs +++ b/parquet/src/data_type.rs @@ -17,12 +17,12 @@ //! 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; use std::ops::{Deref, DerefMut}; use std::str::from_utf8; -use bytes::Bytes; use crate::basic::Type; use crate::column::reader::{ColumnReader, ColumnReaderImpl};