Skip to content

Commit 75eb71f

Browse files
committed
update doc
1 parent d7dda39 commit 75eb71f

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

parquet-variant/src/variant.rs

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,24 @@ impl Deref for ShortString<'_> {
154154
/// [specification]: https://github.com/apache/parquet-format/blob/master/VariantEncoding.md
155155
/// [Variant Shredding specification]: https://github.com/apache/parquet-format/blob/master/VariantShredding.md
156156
///
157+
/// # Casting Semantics
158+
///
159+
/// Scalar conversion semantics intentionally follow Arrow cast behavior where applicable.
160+
/// Conversions in this module delegate to Arrow compute cast helpers such as
161+
/// [`num_cast`], [`cast_num_to_bool`], [`single_bool_to_numeric`], and
162+
/// [`cast_single_string_to_boolean_default`].
163+
///
164+
/// - [`Self::as_boolean`] accepts boolean, numeric, and string variants.
165+
/// Numeric zero maps to `false`; non-zero maps to `true`. String parsing follows
166+
/// Arrow UTF8-to-boolean cast rules.
167+
/// - Numeric accessors such as [`Self::as_int8`], [`Self::as_int64`], [`Self::as_u8`],
168+
/// [`Self::as_u64`], [`Self::as_f16`], [`Self::as_f32`], and [`Self::as_f64`] accept
169+
/// boolean and numeric variants (integers, floating-point, and decimals with scale `0`).
170+
/// They return `None` when conversion is not possible.
171+
/// - Decimal accessors such as [`Self::as_decimal4`], [`Self::as_decimal8`], and
172+
/// [`Self::as_decimal16`] accept compatible decimal variants and integer variants.
173+
/// They return `None` when conversion is not possible.
174+
///
157175
/// # Examples:
158176
///
159177
/// ## Creating `Variant` from Rust Types

0 commit comments

Comments
 (0)