You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Variant] variant_get cast errors lose the requested path #10651
Primitive cast errors from variant_get hardcode the path as VariantPath([]).
The value is extracted before being passed to the primitive conversion builder, so the builder no longer knows the original path requested by the caller.
The diagnostic also exposes the Variant value's internal Debug representation. There is an existing TODO to format this more cleanly.
To Reproduce
use std::sync::Arc;use arrow::array::{ArrayRef,StringArray};use arrow::compute::CastOptions;use arrow::datatypes::{DataType,Field};use parquet_variant::VariantPath;use parquet_variant_compute::{GetOptions, json_to_variant, variant_get};#[test]fnvariant_get_cast_error_loses_requested_path(){let input:ArrayRef =
Arc::new(StringArray::from(vec![r#"{"a":"n/a"}"#]));let variant = ArrayRef::from(json_to_variant(&input).unwrap());let options = GetOptions::new_with_path(VariantPath::try_from("a").unwrap(),).with_as_type(Some(Arc::new(Field::new("result",DataType::Int32,true,)))).with_cast_options(CastOptions{safe:false,
..Default::default()});let error = variant_get(&variant, options).unwrap_err();assert_eq!(
error.to_string(),r#"Cast error: Failed to extract primitive of type Int32 from variant ShortString(ShortString("n/a")) at path VariantPath([])"#);}
The error reports an empty path even though a was requested.
Expected behavior
The error should report the complete path requested by the caller—in this example, a—and display the offending value cleanly rather than as ShortString(ShortString("n/a")).
For partially shredded values, the reported path should include any prefix already traversed through shredded fields.
Additional context
The error likely needs to be constructed or enriched at a layer that retains the original path. The unshredded fallback receives only the remaining path suffix, which is insufficient to produce the complete path after partially shredded traversal.
changed the title [-]`variant_get` cast errors lose the requested path[/-][+][Variant] `variant_get` cast errors lose the requested path[/+]on Aug 11, 2026
take — I'll work on preserving the requested VariantPath through cast failures and add regression coverage for the full path including partially shredded traversal.
Activity
[-]`variant_get` cast errors lose the requested path[/-][+][Variant] `variant_get` cast errors lose the requested path[/+]HussainQadri commentedon Aug 12, 2026
take — I'll work on preserving the requested VariantPath through cast failures and add regression coverage for the full path including partially shredded traversal.