Skip to content
Draft
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
16 changes: 16 additions & 0 deletions arrow-schema/src/extension/canonical/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ mod json;
pub use json::{Json, JsonMetadata};
mod opaque;
pub use opaque::{Opaque, OpaqueMetadata};
mod timestamp_with_offset;
pub use timestamp_with_offset::TimestampWithOffset;
mod uuid;
pub use uuid::Uuid;
mod variable_shape_tensor;
Expand Down Expand Up @@ -77,6 +79,11 @@ pub enum CanonicalExtensionType {
///
/// <https://arrow.apache.org/docs/format/CanonicalExtensions.html#bit-boolean>
Bool8(Bool8),

/// The extension type for `TimestampWithOffset`.
///
/// <https://arrow.apache.org/docs/format/CanonicalExtensions.html#timestamp-with-offset>
TimestampWithOffset(TimestampWithOffset),
}

impl TryFrom<&Field> for CanonicalExtensionType {
Expand All @@ -97,6 +104,9 @@ impl TryFrom<&Field> for CanonicalExtensionType {
Uuid::NAME => value.try_extension_type::<Uuid>().map(Into::into),
Opaque::NAME => value.try_extension_type::<Opaque>().map(Into::into),
Bool8::NAME => value.try_extension_type::<Bool8>().map(Into::into),
TimestampWithOffset::NAME => value
.try_extension_type::<TimestampWithOffset>()
.map(Into::into),
_ => Err(ArrowError::InvalidArgumentError(format!(
"Unsupported canonical extension type: {name}"
))),
Expand Down Expand Up @@ -148,3 +158,9 @@ impl From<Bool8> for CanonicalExtensionType {
CanonicalExtensionType::Bool8(value)
}
}

impl From<TimestampWithOffset> for CanonicalExtensionType {
fn from(value: TimestampWithOffset) -> Self {
CanonicalExtensionType::TimestampWithOffset(value)
}
}
Loading