Skip to content

[Variant] VariantArray::value silently returns Variant::Null for unimplemented typed_value types in release builds #10597

Closed

Description

@raghav-reglobe

Describe the bug

VariantArray::try_value / value convert scalar typed_value types, but the fallback arm for everything else is:

// https://github.com/apache/arrow-rs/issues/8091
debug_assert!(false, "Unsupported typed_value type: {}", typed_value.data_type());
Ok(Variant::Null)

In release builds the debug_assert! compiles out, so reading a row whose typed_value is valid but of an unimplemented type (e.g. an object-shredded Struct) silently returns Variant::Null — stored data reads as null with no error and no signal. In debug builds the same read panics. #8091 is closed (the scalar conversions landed there), so nothing currently tracks this arm.

To Reproduce

use arrow_array::{ArrayRef, StringArray};
use arrow_schema::{DataType, Field};
use parquet_variant_compute::{json_to_variant, shred_variant};
use std::sync::Arc;

let json: ArrayRef = Arc::new(StringArray::from(vec![r#"{"qty": 3}"#]));
let variant = json_to_variant(&json).unwrap();
let shred_type = DataType::Struct(vec![Field::new("qty", DataType::Int64, true)].into());
let shredded = shred_variant(&variant, &shred_type).unwrap();

// debug build: panics "Unsupported typed_value type: Struct(...)"
// release build: returns Variant::Null — the stored {"qty": 3} reads as null
let v = shredded.value(0);

Hit in practice rendering shredded variant columns through a value()-based canonicalization path: every typed row rendered as JSON null in a release build, with nothing to indicate loss.

Expected behavior

An error. try_value already documents "Errors if the data in typed_value cannot be interpreted as a valid Variant" — returning ArrowError::NotYetImplemented for these types keeps wrong-data out of release builds and makes debug/release behavior consistent, until the remaining conversions are implemented (the borrowed Variant<'_, '_> return can't express an assembled object without owned bytes, so the full fix is a larger change).

Happy to send the small error-instead-of-null PR.

Activity

  1. added a commit that references this issue on Aug 14, 2026
    257f5f2
  2. added a commit that references this issue on Aug 19, 2026
    35a0346
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions