Parquet Native Type Trait (parquet/types.rs)

polars · crates/polars-parquet/src/parquet/types.rs · rust · MIT
database, dev-tools, tag:parquet, tag:data, tag:columnar

Provides physical native data type representations and endian conversions for Parquet data. Reuse when building high-performance columnar data storage engines.

// Source: https://github.com/pola-rs/polars | License: MIT | Copyright 2025 Ritchie Vink
// Provided via justclaw.it.com; keep this notice with the code.
use num_traits::{FromBytes, ToBytes, Zero};
use polars_arrow::types::{
    AlignedBytes, Bytes2Alignment2, Bytes4Alignment4, Bytes8Alignment8, Bytes12Alignment4,
};
use polars_utils::float16::pf16;

use crate::parquet::schema::types::PhysicalType;
use crate::read::expr::ParquetScalar;

/// A physical native representation of a Parquet fixed-sized type.
pub trait NativeType:
    std::fmt::Debug
    + Send
    + Sync
    + 'static
    + Copy
    + Clone
    + bytemuck::Pod
    + for<'a> TryFrom<&'a ParquetScalar>
{
    type Bytes: AsRef<[u8]>
        + bytemuck::Pod
        + IntoIterator<Item = u8>
        + for<'a> TryFrom<&'a [u8], Erro

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search for more like it.

Get a free API key