parquet::data_type::private

Trait ParquetValueType

Source
pub trait ParquetValueType:
    PartialEq
    + Debug
    + Display
    + Default
    + Clone
    + AsBytes
    + FromBytes
    + SliceAsBytes
    + PartialOrd
    + Send
    + HeapSize
    + GetDecoder
    + MakeStatistics {
    const PHYSICAL_TYPE: Type;

    // Required methods
    fn encode<W: Write>(
        values: &[Self],
        writer: &mut W,
        bit_writer: &mut BitWriter,
    ) -> Result<()>;
    fn set_data(
        decoder: &mut PlainDecoderDetails,
        data: Bytes,
        num_values: usize,
    );
    fn decode(
        buffer: &mut [Self],
        decoder: &mut PlainDecoderDetails,
    ) -> Result<usize>;
    fn skip(
        decoder: &mut PlainDecoderDetails,
        num_values: usize,
    ) -> Result<usize>;
    fn as_any(&self) -> &dyn Any;
    fn as_mut_any(&mut self) -> &mut dyn Any;

    // Provided methods
    fn dict_encoding_size(&self) -> (usize, usize) { ... }
    fn variable_length_bytes(_: &[Self]) -> Option<i64> { ... }
    fn as_i64(&self) -> Result<i64> { ... }
    fn as_u64(&self) -> Result<u64> { ... }
    fn set_from_bytes(&mut self, _data: Bytes) { ... }
}
Expand description

Sealed trait to start to remove specialisation from implementations

This is done to force the associated value type to be unimplementable outside of this crate, and thus hint to the type system (and end user) traits are public for the contract and not for extension.

Required Associated Constants§

Required Methods§

Source

fn encode<W: Write>( values: &[Self], writer: &mut W, bit_writer: &mut BitWriter, ) -> Result<()>

Encode the value directly from a higher level encoder

Source

fn set_data(decoder: &mut PlainDecoderDetails, data: Bytes, num_values: usize)

Establish the data that will be decoded in a buffer

Source

fn decode( buffer: &mut [Self], decoder: &mut PlainDecoderDetails, ) -> Result<usize>

Decode the value from a given buffer for a higher level decoder

Source

fn skip(decoder: &mut PlainDecoderDetails, num_values: usize) -> Result<usize>

Source

fn as_any(&self) -> &dyn Any

Return the value as an Any to allow for downcasts without transmutation

Source

fn as_mut_any(&mut self) -> &mut dyn Any

Return the value as an mutable Any to allow for downcasts without transmutation

Provided Methods§

Source

fn dict_encoding_size(&self) -> (usize, usize)

Return the encoded size for a type

Source

fn variable_length_bytes(_: &[Self]) -> Option<i64>

Return the number of variable length bytes in a given slice of data

Returns the sum of lengths for BYTE_ARRAY data, and None for all other data types

Source

fn as_i64(&self) -> Result<i64>

Return the value as i64 if possible

This is essentially the same as std::convert::TryInto<i64> but can’t be implemented for f32 and f64, types that would fail orphan rules

Source

fn as_u64(&self) -> Result<u64>

Return the value as u64 if possible

This is essentially the same as std::convert::TryInto<u64> but can’t be implemented for f32 and f64, types that would fail orphan rules

Source

fn set_from_bytes(&mut self, _data: Bytes)

Sets the value of this object from the provided [Bytes]

Only implemented for ByteArray and FixedLenByteArray. Will panic for other types.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl ParquetValueType for bool

Source§

const PHYSICAL_TYPE: Type = Type::BOOLEAN

Source§

fn encode<W: Write>( values: &[Self], _: &mut W, bit_writer: &mut BitWriter, ) -> Result<()>

Source§

fn set_data(decoder: &mut PlainDecoderDetails, data: Bytes, num_values: usize)

Source§

fn decode( buffer: &mut [Self], decoder: &mut PlainDecoderDetails, ) -> Result<usize>

Source§

fn skip(decoder: &mut PlainDecoderDetails, num_values: usize) -> Result<usize>

Source§

fn as_i64(&self) -> Result<i64>

Source§

fn as_any(&self) -> &dyn Any

Source§

fn as_mut_any(&mut self) -> &mut dyn Any

Source§

impl ParquetValueType for f32

Source§

const PHYSICAL_TYPE: Type = Type::FLOAT

Source§

fn encode<W: Write>( values: &[Self], writer: &mut W, _: &mut BitWriter, ) -> Result<()>

Source§

fn set_data(decoder: &mut PlainDecoderDetails, data: Bytes, num_values: usize)

Source§

fn decode( buffer: &mut [Self], decoder: &mut PlainDecoderDetails, ) -> Result<usize>

Source§

fn skip(decoder: &mut PlainDecoderDetails, num_values: usize) -> Result<usize>

Source§

fn as_i64(&self) -> Result<i64>

Source§

fn as_any(&self) -> &dyn Any

Source§

fn as_mut_any(&mut self) -> &mut dyn Any

Source§

impl ParquetValueType for f64

Source§

const PHYSICAL_TYPE: Type = Type::DOUBLE

Source§

fn encode<W: Write>( values: &[Self], writer: &mut W, _: &mut BitWriter, ) -> Result<()>

Source§

fn set_data(decoder: &mut PlainDecoderDetails, data: Bytes, num_values: usize)

Source§

fn decode( buffer: &mut [Self], decoder: &mut PlainDecoderDetails, ) -> Result<usize>

Source§

fn skip(decoder: &mut PlainDecoderDetails, num_values: usize) -> Result<usize>

Source§

fn as_i64(&self) -> Result<i64>

Source§

fn as_any(&self) -> &dyn Any

Source§

fn as_mut_any(&mut self) -> &mut dyn Any

Source§

impl ParquetValueType for i32

Source§

const PHYSICAL_TYPE: Type = Type::INT32

Source§

fn encode<W: Write>( values: &[Self], writer: &mut W, _: &mut BitWriter, ) -> Result<()>

Source§

fn set_data(decoder: &mut PlainDecoderDetails, data: Bytes, num_values: usize)

Source§

fn decode( buffer: &mut [Self], decoder: &mut PlainDecoderDetails, ) -> Result<usize>

Source§

fn skip(decoder: &mut PlainDecoderDetails, num_values: usize) -> Result<usize>

Source§

fn as_i64(&self) -> Result<i64>

Source§

fn as_any(&self) -> &dyn Any

Source§

fn as_mut_any(&mut self) -> &mut dyn Any

Source§

impl ParquetValueType for i64

Source§

const PHYSICAL_TYPE: Type = Type::INT64

Source§

fn encode<W: Write>( values: &[Self], writer: &mut W, _: &mut BitWriter, ) -> Result<()>

Source§

fn set_data(decoder: &mut PlainDecoderDetails, data: Bytes, num_values: usize)

Source§

fn decode( buffer: &mut [Self], decoder: &mut PlainDecoderDetails, ) -> Result<usize>

Source§

fn skip(decoder: &mut PlainDecoderDetails, num_values: usize) -> Result<usize>

Source§

fn as_i64(&self) -> Result<i64>

Source§

fn as_any(&self) -> &dyn Any

Source§

fn as_mut_any(&mut self) -> &mut dyn Any

Implementors§