Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions vortex-array/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ tabled = { workspace = true, optional = true, default-features = false, features
] }
termtree = { workspace = true }
tracing = { workspace = true }
uuid = { workspace = true }
vortex-buffer = { workspace = true, features = ["arrow"] }
vortex-error = { workspace = true, features = ["flatbuffers"] }
vortex-flatbuffers = { workspace = true, features = ["array", "dtype"] }
Expand Down
94 changes: 94 additions & 0 deletions vortex-array/public-api.lock
Original file line number Diff line number Diff line change
Expand Up @@ -7038,6 +7038,24 @@ pub fn vortex_array::extension::datetime::Timestamp::validate_dtype(&self, _meta

pub fn vortex_array::extension::datetime::Timestamp::validate_scalar_value(&self, metadata: &Self::Metadata, storage_dtype: &vortex_array::dtype::DType, storage_value: &vortex_array::scalar::ScalarValue) -> vortex_error::VortexResult<()>

impl vortex_array::dtype::extension::ExtVTable for vortex_array::extension::uuid::Uuid

pub type vortex_array::extension::uuid::Uuid::Metadata = vortex_array::extension::uuid::UuidMetadata

pub type vortex_array::extension::uuid::Uuid::NativeValue<'a> = uuid::Uuid

pub fn vortex_array::extension::uuid::Uuid::deserialize_metadata(&self, metadata: &[u8]) -> vortex_error::VortexResult<Self::Metadata>

pub fn vortex_array::extension::uuid::Uuid::id(&self) -> vortex_array::dtype::extension::ExtId

pub fn vortex_array::extension::uuid::Uuid::serialize_metadata(&self, metadata: &Self::Metadata) -> vortex_error::VortexResult<alloc::vec::Vec<u8>>

pub fn vortex_array::extension::uuid::Uuid::unpack_native<'a>(&self, metadata: &'a Self::Metadata, _storage_dtype: &'a vortex_array::dtype::DType, storage_value: &'a vortex_array::scalar::ScalarValue) -> vortex_error::VortexResult<Self::NativeValue>

pub fn vortex_array::extension::uuid::Uuid::validate_dtype(&self, _metadata: &Self::Metadata, storage_dtype: &vortex_array::dtype::DType) -> vortex_error::VortexResult<()>

pub fn vortex_array::extension::uuid::Uuid::validate_scalar_value(&self, metadata: &Self::Metadata, storage_dtype: &vortex_array::dtype::DType, storage_value: &vortex_array::scalar::ScalarValue) -> vortex_error::VortexResult<()>

pub trait vortex_array::dtype::extension::Matcher

pub type vortex_array::dtype::extension::Matcher::Match<'a>
Expand Down Expand Up @@ -11002,6 +11020,82 @@ pub fn vortex_array::extension::datetime::TimestampOptions::hash<__H: core::hash

impl core::marker::StructuralPartialEq for vortex_array::extension::datetime::TimestampOptions

pub mod vortex_array::extension::uuid

pub struct vortex_array::extension::uuid::Uuid

impl core::clone::Clone for vortex_array::extension::uuid::Uuid

pub fn vortex_array::extension::uuid::Uuid::clone(&self) -> vortex_array::extension::uuid::Uuid

impl core::cmp::Eq for vortex_array::extension::uuid::Uuid

impl core::cmp::PartialEq for vortex_array::extension::uuid::Uuid

pub fn vortex_array::extension::uuid::Uuid::eq(&self, other: &vortex_array::extension::uuid::Uuid) -> bool

impl core::default::Default for vortex_array::extension::uuid::Uuid

pub fn vortex_array::extension::uuid::Uuid::default() -> vortex_array::extension::uuid::Uuid

impl core::fmt::Debug for vortex_array::extension::uuid::Uuid

pub fn vortex_array::extension::uuid::Uuid::fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result

impl core::hash::Hash for vortex_array::extension::uuid::Uuid

pub fn vortex_array::extension::uuid::Uuid::hash<__H: core::hash::Hasher>(&self, state: &mut __H)

impl core::marker::StructuralPartialEq for vortex_array::extension::uuid::Uuid

impl vortex_array::dtype::extension::ExtVTable for vortex_array::extension::uuid::Uuid

pub type vortex_array::extension::uuid::Uuid::Metadata = vortex_array::extension::uuid::UuidMetadata

pub type vortex_array::extension::uuid::Uuid::NativeValue<'a> = uuid::Uuid

pub fn vortex_array::extension::uuid::Uuid::deserialize_metadata(&self, metadata: &[u8]) -> vortex_error::VortexResult<Self::Metadata>

pub fn vortex_array::extension::uuid::Uuid::id(&self) -> vortex_array::dtype::extension::ExtId

pub fn vortex_array::extension::uuid::Uuid::serialize_metadata(&self, metadata: &Self::Metadata) -> vortex_error::VortexResult<alloc::vec::Vec<u8>>

pub fn vortex_array::extension::uuid::Uuid::unpack_native<'a>(&self, metadata: &'a Self::Metadata, _storage_dtype: &'a vortex_array::dtype::DType, storage_value: &'a vortex_array::scalar::ScalarValue) -> vortex_error::VortexResult<Self::NativeValue>

pub fn vortex_array::extension::uuid::Uuid::validate_dtype(&self, _metadata: &Self::Metadata, storage_dtype: &vortex_array::dtype::DType) -> vortex_error::VortexResult<()>

pub fn vortex_array::extension::uuid::Uuid::validate_scalar_value(&self, metadata: &Self::Metadata, storage_dtype: &vortex_array::dtype::DType, storage_value: &vortex_array::scalar::ScalarValue) -> vortex_error::VortexResult<()>

pub struct vortex_array::extension::uuid::UuidMetadata

pub vortex_array::extension::uuid::UuidMetadata::version: core::option::Option<uuid::Version>

impl core::clone::Clone for vortex_array::extension::uuid::UuidMetadata

pub fn vortex_array::extension::uuid::UuidMetadata::clone(&self) -> vortex_array::extension::uuid::UuidMetadata

impl core::cmp::Eq for vortex_array::extension::uuid::UuidMetadata

impl core::cmp::PartialEq for vortex_array::extension::uuid::UuidMetadata

pub fn vortex_array::extension::uuid::UuidMetadata::eq(&self, other: &Self) -> bool

impl core::default::Default for vortex_array::extension::uuid::UuidMetadata

pub fn vortex_array::extension::uuid::UuidMetadata::default() -> vortex_array::extension::uuid::UuidMetadata

impl core::fmt::Debug for vortex_array::extension::uuid::UuidMetadata

pub fn vortex_array::extension::uuid::UuidMetadata::fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result

impl core::fmt::Display for vortex_array::extension::uuid::UuidMetadata

pub fn vortex_array::extension::uuid::UuidMetadata::fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result

impl core::hash::Hash for vortex_array::extension::uuid::UuidMetadata

pub fn vortex_array::extension::uuid::UuidMetadata::hash<H: core::hash::Hasher>(&self, state: &mut H)

pub struct vortex_array::extension::EmptyMetadata

impl core::clone::Clone for vortex_array::extension::EmptyMetadata
Expand Down
1 change: 1 addition & 0 deletions vortex-array/src/extension/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
use std::fmt;

pub mod datetime;
pub mod uuid;

#[cfg(test)]
mod tests;
Expand Down
63 changes: 63 additions & 0 deletions vortex-array/src/extension/uuid/metadata.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
// SPDX-License-Identifier: Apache-2.0
// SPDX-FileCopyrightText: Copyright the Vortex contributors

use std::fmt;
use std::hash::Hash;
use std::hash::Hasher;

use uuid::Version;
use vortex_error::VortexResult;
use vortex_error::vortex_bail;

/// Converts a `u8` discriminant back to a [`uuid::Version`].
pub(crate) fn u8_to_version(b: u8) -> VortexResult<Version> {
match b {
0 => Ok(Version::Nil),
1 => Ok(Version::Mac),
2 => Ok(Version::Dce),
3 => Ok(Version::Md5),
4 => Ok(Version::Random),
5 => Ok(Version::Sha1),
6 => Ok(Version::SortMac),
7 => Ok(Version::SortRand),
8 => Ok(Version::Custom),
0xff => Ok(Version::Max),
_ => vortex_bail!("unknown UUID version discriminant: {b}"),
}
}

/// Metadata for the UUID extension type.
///
/// Optionally records which UUID version the column contains (e.g. v4 random, v7
/// sort-random). When `None`, the column may contain any mix of versions.
#[derive(Clone, Debug, Default)]
pub struct UuidMetadata {
/// The UUID version, if known.
pub version: Option<Version>,
}

impl fmt::Display for UuidMetadata {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
match self.version {
None => write!(f, ""),
Some(v) => write!(f, "v{}", v as u8),
}
}
}

// `uuid::Version` derives `PartialEq` but not `Eq` or `Hash`, so we implement these
// manually using the `#[repr(u8)]` discriminant.

impl PartialEq for UuidMetadata {
fn eq(&self, other: &Self) -> bool {
self.version.map(|v| v as u8) == other.version.map(|v| v as u8)
}
}

impl Eq for UuidMetadata {}

impl Hash for UuidMetadata {
fn hash<H: Hasher>(&self, state: &mut H) {
self.version.map(|v| v as u8).hash(state);
}
}
20 changes: 20 additions & 0 deletions vortex-array/src/extension/uuid/mod.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
// SPDX-License-Identifier: Apache-2.0
// SPDX-FileCopyrightText: Copyright the Vortex contributors

//! UUID extension type for Vortex.
//!
//! Provides a UUID extension type backed by `FixedSizeList(Primitive(U8), 16)` storage. Each UUID
//! is stored as 16 bytes in big-endian (network) byte order, matching [RFC 4122] and Arrow's
//! [canonical UUID extension].
//!
//! [RFC 4122]: https://www.rfc-editor.org/rfc/rfc4122
//! [canonical UUID extension]: https://arrow.apache.org/docs/format/CanonicalExtensions.html#uuid

mod metadata;
pub use metadata::UuidMetadata;

pub(crate) mod vtable;

/// The VTable for the UUID extension type.
#[derive(Clone, Debug, Default, PartialEq, Eq, Hash)]
pub struct Uuid;
Loading
Loading